Home
Support Forums

Deploys for distracted-easley-47f2bc / Build script returned non-zero exit code: 2

I am new to Netlify and receiving an error that I can’t seem to correct. Based on what I’ve researched I have tried to deploy my site also using CI= npm run build and it still did not deploy. I’ve attached a copy of the output I received. thank for any assistance

11:10:31 PM: Build ready to start
11:10:34 PM: build-image version: 3bcb38c35508b42e9121d4badfe6d8c66fd7a3f0
11:10:34 PM: build-image tag: v4.3.2
11:10:34 PM: buildbot version: 04fb57a6b52e36fc0fd306c97e17aa22ebf93b50
11:10:34 PM: Building without cache
11:10:34 PM: Starting to prepare the repo for build
11:10:34 PM: No cached dependencies found. Cloning fresh repo
11:10:34 PM: git clone
11:10:35 PM: Preparing Git Reference refs/heads/master
11:10:35 PM: Parsing package.json dependencies
11:10:36 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘dist’ versus ‘./dist’ in the Netlify UI
11:10:36 PM: Starting build script
11:10:36 PM: Installing dependencies
11:10:36 PM: Python version set to 2.7
11:10:37 PM: Downloading and installing node v16.11.1…
11:10:37 PM: Downloading https://nodejs.org/dist/v16.11.1/node-v16.11.1-linux-x64.tar.xz
11:10:37 PM: Computing checksum with sha256sum
11:10:38 PM: Checksums matched!
11:10:41 PM: Now using node v16.11.1 (npm v8.0.0)
11:10:41 PM: Started restoring cached build plugins
11:10:41 PM: Finished restoring cached build plugins
11:10:41 PM: Attempting ruby version 2.7.2, read from environment
11:10:42 PM: Using ruby version 2.7.2
11:10:42 PM: Using PHP version 8.0
11:10:42 PM: Started restoring cached node modules
11:10:42 PM: Finished restoring cached node modules
11:10:43 PM: Installing NPM modules using NPM version 8.0.0
11:10:44 PM: npm WARN old lockfile
11:10:44 PM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
11:10:44 PM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
11:10:44 PM: npm WARN old lockfile
11:10:44 PM: npm WARN old lockfile This is a one-time fix-up, please be patient…
11:10:44 PM: npm WARN old lockfile
11:10:56 PM: npm WARN deprecated urix@0.1.0: Please see
11:10:56 PM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
11:10:56 PM: npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
11:10:57 PM: npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See There’s Math.random(), and then there’s Math.random() · V8 for details.
11:10:58 PM: npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see Request’s Past, Present and Future · Issue #3142 · request/request · GitHub
11:10:58 PM: npm WARN deprecated request@2.88.2: request has been deprecated, see Request’s Past, Present and Future · Issue #3142 · request/request · GitHub
11:11:00 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
11:11:01 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
11:11:02 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
11:11:03 PM: npm WARN deprecated parcel-bundler@1.12.5: Parcel v1 is no longer maintained. Please migrate to v2, which is published under the ‘parcel’ package. See Migration for details.
11:11:04 PM: npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
11:11:05 PM: added 779 packages, and audited 780 packages in 21s
11:11:05 PM: 52 packages are looking for funding
11:11:05 PM: run npm fund for details
11:11:05 PM: 30 vulnerabilities (13 moderate, 17 high)
11:11:05 PM: To address issues that do not require attention, run:
11:11:05 PM: npm audit fix
11:11:05 PM: To address all issues (including breaking changes), run:
11:11:05 PM: npm audit fix --force
11:11:05 PM: Run npm audit for details.
11:11:05 PM: NPM modules installed
11:11:05 PM: Started restoring cached go cache
11:11:05 PM: Finished restoring cached go cache
11:11:05 PM: go version go1.16.5 linux/amd64
11:11:05 PM: go version go1.16.5 linux/amd64
11:11:05 PM: Installing missing commands
11:11:05 PM: Verify run directory
11:11:07 PM: ​
11:11:07 PM: ────────────────────────────────────────────────────────────────
11:11:07 PM: Netlify Build
11:11:07 PM: ────────────────────────────────────────────────────────────────
11:11:07 PM: ​
11:11:07 PM: ❯ Version
11:11:07 PM: @netlify/build 18.17.0
11:11:07 PM: ​
11:11:07 PM: ❯ Flags
11:11:07 PM: baseRelDir: true
11:11:07 PM: buildId: 6167adb71e9dfa5b9a678622
11:11:07 PM: deployId: 6167adb71e9dfa5b9a678624
11:11:07 PM: ​
11:11:07 PM: ❯ Current directory
11:11:07 PM: /opt/build/repo
11:11:07 PM: ​
11:11:07 PM: ❯ Config file
11:11:07 PM: No config file was defined: using default values.
11:11:07 PM: ​
11:11:07 PM: ❯ Context
11:11:07 PM: production
11:11:07 PM: ​
11:11:07 PM: ────────────────────────────────────────────────────────────────
11:11:07 PM: 1. Build command from Netlify app
11:11:07 PM: ────────────────────────────────────────────────────────────────
11:11:07 PM: ​
11:11:07 PM: $ npm run parcel-build
11:11:07 PM: > savvy-starter@1.0.0 parcel-build
11:11:07 PM: > parcel build index.html && cp_redirects ./dist
11:11:19 PM: :warning: /opt/build/repo/node_modules/dotenv/lib/main.js:101:41: Cannot statically evaluate fs argument
11:11:19 PM: 99 | try {
11:11:19 PM: 100 | // specifying an encoding returns a string instead of a buffer
11:11:19 PM: > 101 | const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug })
11:11:19 PM: | ^
11:11:19 PM: 102 |
11:11:19 PM: 103 | Object.keys(parsed).forEach(function (key) {
11:11:19 PM: 104 | if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
11:11:19 PM: :warning: /opt/build/repo/node_modules/dotenv/lib/main.js:101:41: Cannot statically evaluate fs argument
11:11:19 PM: 99 | try {
11:11:19 PM: 100 | // specifying an encoding returns a string instead of a buffer
11:11:19 PM: > 101 | const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug })
11:11:19 PM: | ^
11:11:19 PM: 102 |
11:11:19 PM: 103 | Object.keys(parsed).forEach(function (key) {
11:11:19 PM: 104 | if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
11:11:23 PM: :sparkles: Built in 14.71s.
11:11:23 PM: dist/repo.de1b4db7.js.map 842.17 KB 59ms
11:11:23 PM: dist/repo.de1b4db7.js 135.38 KB 12.90s
11:11:23 PM: dist/style.b15d3bf7.css.map 2.01 KB 2ms
11:11:23 PM: dist/style.b15d3bf7.css 1.11 KB 9.56s
11:11:23 PM: dist/index.html 705 B 1.68s
11:11:23 PM: sh: 1: cp_redirects: not found
11:11:23 PM: ​
11:11:23 PM: ────────────────────────────────────────────────────────────────
11:11:23 PM: “build.command” failed
11:11:23 PM: ────────────────────────────────────────────────────────────────
11:11:23 PM: ​
11:11:23 PM: Error message
11:11:23 PM: Command failed with exit code 127: npm run parcel-build
11:11:23 PM: ​
11:11:23 PM: Error location
11:11:23 PM: In Build command from Netlify app:
11:11:23 PM: npm run parcel-build
11:11:23 PM: ​
11:11:23 PM: Resolved config
11:11:23 PM: build:
11:11:23 PM: command: npm run parcel-build
11:11:23 PM: commandOrigin: ui
11:11:23 PM: environment:
11:11:23 PM: - OPEN_WEATHER_MAP_API_KEY
11:11:23 PM: publish: /opt/build/repo/dist
11:11:23 PM: publishOrigin: ui
11:11:23 PM: Caching artifacts
11:11:23 PM: Started saving node modules
11:11:23 PM: Finished saving node modules
11:11:23 PM: Started saving build plugins
11:11:23 PM: Finished saving build plugins
11:11:23 PM: Started saving pip cache
11:11:23 PM: Finished saving pip cache
11:11:23 PM: Started saving emacs cask dependencies
11:11:23 PM: Finished saving emacs cask dependencies
11:11:23 PM: Started saving maven dependencies
11:11:24 PM: Finished saving maven dependencies
11:11:24 PM: Started saving boot dependencies
11:11:24 PM: Finished saving boot dependencies
11:11:24 PM: Started saving rust rustup cache
11:11:24 PM: Finished saving rust rustup cache
11:11:24 PM: Started saving go dependencies
11:11:24 PM: Finished saving go dependencies
11:11:26 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:11:26 PM: Creating deploy upload records
11:11:26 PM: Failing build: Failed to build site
11:11:26 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
11:11:26 PM: Finished processing build request in 52.375949233s

Looks like dotenv is having troubles reading your env file. I’ advise setting environment variables in Netlify UI and using them directly using process.env.