Exit Code 1 & Build script returned non-zero exit code: 2 - Eleventy issues

Hi all -

I am trying to post my Obsidian Vault (Obsidian.md) using Netlify and GitHub and the Obsidian Digital Garden Plug In.

I was able to post one page with no issues, but posting more of the Vault chronically fails. I have tried to fix this with the guidance in the logs, but I am not a coder and made things worse (now reverted back to original config file). The below log is from a full rebuild, but the same thing happens with a non-full build.

I am hoping someone can help me out. (I had to (.) or xxx some of the http leaders of some of the sites in the log due to a number restriction of urls)

Site: https://osintprojectur.netlify.app

12:18:32 PM: Build ready to start
12:18:40 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
12:18:40 PM: build-image tag: v4.10.1
12:18:40 PM: buildbot version: d6cba5c3bdf3b91d18560394ac53604c4ddc280f
12:18:40 PM: Building without cache
12:18:40 PM: Starting to prepare the repo for build
12:18:40 PM: No cached dependencies found. Cloning fresh repo
12:18:40 PM: git clone https://github(.)com/FarallonWest/OSINT-Project
12:18:41 PM: Preparing Git Reference refs/heads/main
12:18:41 PM: Parsing package.json dependencies
12:18:42 PM: Starting build script
12:18:42 PM: Installing dependencies
12:18:42 PM: Python version set to 2.7
12:18:43 PM: Downloading and installing node v16.17.0…
12:18:43 PM: Downloading hxxx:nodejs(.)org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz…
12:18:44 PM: Computing checksum with sha256sum
12:18:45 PM: Checksums matched!
12:18:47 PM: Now using node v16.17.0 (npm v8.15.0)
12:18:47 PM: Started restoring cached build plugins
12:18:47 PM: Finished restoring cached build plugins
12:18:47 PM: Attempting ruby version 2.7.2, read from environment
12:18:47 PM: Using ruby version 2.7.2
12:18:48 PM: Using PHP version 8.0
12:18:48 PM: No npm workspaces detected
────────────────────────────────────────────────────────────────
12:19:22 PM: 1. build.command from netlify.toml
12:19:22 PM: ────────────────────────────────────────────────────────────────
12:19:22 PM: ​
12:19:22 PM: $ npm install && npm run build
12:19:23 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:19:23 PM: npm WARN config location in the cache, and they are managed by
12:19:23 PM: npm WARN config cacache.
12:19:24 PM: up to date, audited 637 packages in 843ms
12:19:24 PM: 69 packages are looking for funding
12:19:24 PM: run npm fund for details
12:19:24 PM: 13 vulnerabilities (5 moderate, 6 high, 2 critical)
12:19:24 PM: To address all issues, run:
12:19:24 PM: npm audit fix
12:19:24 PM: Run npm audit for details.
12:19:24 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:19:24 PM: npm WARN config location in the cache, and they are managed by
12:19:24 PM: npm WARN config cacache.
12:19:24 PM: > web@1.0.0 build
12:19:24 PM: > npm-run-all build:*
12:19:24 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:19:24 PM: npm WARN config location in the cache, and they are managed by
12:19:24 PM: npm WARN config cacache.
12:19:24 PM: > web@1.0.0 build:eleventy
12:19:24 PM: > cross-env ELEVENTY_ENV=prod NODE_OPTIONS=–max-old-space-size=4096 eleventy
12:19:25 PM: [11ty] Problem writing Eleventy templates: (more in DEBUG output)
12:19:25 PM: [11ty] > date front matter value (2022.05.12) is invalid for ./src/site/notes/Russia sends relatives of Ukrainian soldiers and other Mariupol residents to β€˜concentration camp’ in occupied Donbas.md
12:19:25 PM: Error was thrown:
12:19:25 PM: [11ty] Error: date front matter value (2022.05.12) is invalid for ./src/site/notes/Russia sends relatives of Ukrainian soldiers and other Mariupol residents to β€˜concentration camp’ in occupied Donbas.md
12:19:25 PM: at Template.getMappedDate (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:1020:19)
12:19:25 PM: at Template.addPageDate (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:448:30)
12:19:25 PM: at Template.getData (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:429:31)
12:19:25 PM: at async Template.getTemplateMapEntries (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:1066:33)
12:19:25 PM: at async TemplateMap.add (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateMap.js:59:21)
12:19:25 PM: at async Promise.all (index 156)
12:19:25 PM: at async TemplateWriter._createTemplateMap (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateWriter.js:241:5)
12:19:25 PM: at async TemplateWriter.generateTemplates (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateWriter.js:275:5)
12:19:25 PM: at async TemplateWriter.write (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateWriter.js:321:23)
12:19:25 PM: at async Eleventy.executeBuild (/opt/build/repo/node_modules/@11ty/eleventy/src/Eleventy.js:986:13)
12:19:25 PM: [11ty] Benchmark 221ms 27% 1Γ— (Data) ./src/site/_data/meta.js
12:19:25 PM: [11ty] Wrote 0 files in 0.55 seconds (v1.0.0)
12:19:25 PM: ERROR: β€œbuild:eleventy” exited with 1.
12:19:25 PM: ​
12:19:25 PM: ────────────────────────────────────────────────────────────────
12:19:25 PM: β€œbuild.command” failed
12:19:25 PM: ────────────────────────────────────────────────────────────────
12:19:25 PM: ​
12:19:25 PM: Error message
12:19:25 PM: Command failed with exit code 1: npm install && npm run build (hxxx:/ntl.fyi/exit-code-1)
12:19:25 PM: ​
12:19:25 PM: Error location
12:19:25 PM: In build.command from netlify.toml:
12:19:25 PM: npm install && npm run build
12:19:25 PM: ​
12:19:25 PM: Resolved config
12:19:25 PM: build:
12:19:25 PM: command: npm install && npm run build
12:19:25 PM: commandOrigin: config
12:19:25 PM: environment:
12:19:25 PM: - NETLIFY_GRAPH_TOKEN
12:19:25 PM: - ONEGRAPH_AUTHLIFY_TOKEN
12:19:25 PM: publish: /opt/build/repo/dist
12:19:25 PM: publishOrigin: config
12:19:25 PM: plugins:
12:19:25 PM: - inputs: {}
12:19:25 PM: origin: ui
12:19:25 PM: package: netlify-plugin-debug-cache
12:19:25 PM: - inputs: {}
12:19:25 PM: origin: ui
12:19:25 PM: package: netlify-plugin-is-website-vulnerable
12:19:25 PM: redirects:
12:19:26 PM: - from: /*
status: 404
to: /404
redirectsOrigin: config
Caching artifacts
12:19:26 PM: Started saving node modules
12:19:26 PM: Finished saving node modules
12:19:26 PM: Started saving build plugins
12:19:26 PM: Finished saving build plugins
12:19:26 PM: Started saving pip cache
12:19:26 PM: Finished saving pip cache
12:19:26 PM: Started saving emacs cask dependencies
12:19:26 PM: Finished saving emacs cask dependencies
12:19:26 PM: Started saving maven dependencies
12:19:26 PM: Finished saving maven dependencies
12:19:26 PM: Started saving boot dependencies
12:19:26 PM: Finished saving boot dependencies
12:19:26 PM: Started saving rust rustup cache
12:19:26 PM: Finished saving rust rustup cache
12:19:26 PM: Started saving go dependencies
12:19:26 PM: Finished saving go dependencies
12:19:26 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:19:26 PM: Creating deploy upload records
12:19:27 PM: Failing build: Failed to build site
12:19:27 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2 (hxxx:ntl.fyi/exit-code-2)
12:19:27 PM: Finished processing build request in 46.841212855s

Hey @Farallon

This is the issue. In the above mentioned file the date format (as shown) is 2022.05.12 which is not valid. A valid date (as in note 38) is 2022-05-12.

Fix this (and any other instances) and try the build again. (Note: This should also error if you build locally, which is a good idea to test before deploying to Netlify.)

2 Likes

Thanks! I have been fixing those as I go. This seems to have done the trick. Thanks so much for your help!

1 Like