React site Deployment failed

I am having a problem deploying the React subdirectory of my full stack app.

Netlify site: Netlify App

Tried many times changing up things in the build settings. Each time preceding the build.command message I get an error saying “/opt/build/repo/node_modules/.bin/node: 1: Syntax error: “|” unexpected (expecting “)”)”. I have tried to find a node file in node_modules/.bin but don’t see a file with that name. I’d really appreciate some help in how to proceed. Thanks!

Screenshot of build settings. Not sure if these show up as pictures:

CI = false

Build log: 

"12:38:39 PM: build-image version: c0621868af5001023389eeaa9dbfbbaf313f67e2 (focal)
12:38:39 PM: buildbot version: c0621868af5001023389eeaa9dbfbbaf313f67e2
12:38:39 PM: Fetching cached dependencies
12:38:39 PM: Failed to fetch cache, continuing with build
12:38:39 PM: Starting to prepare the repo for build
12:38:39 PM: No cached dependencies found. Cloning fresh repo
12:38:39 PM: git clone --filter=blob:none https://github.com/enwumeh/perfumery2
12:38:40 PM: Preparing Git Reference refs/heads/main
12:38:42 PM: Parsing package.json dependencies
12:38:43 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'frontend/perfumery2_client/build' versus 'build' in the Netlify UI
12:38:44 PM: Starting to install dependencies
12:38:44 PM: Attempting Ruby version 2.7.2, read from environment
12:38:45 PM: Using Ruby version 2.7.2
12:38:45 PM: Started restoring cached go cache
12:38:45 PM: Finished restoring cached go cache
12:38:45 PM: Installing Go version 1.19.5 (requested 1.19.5)
12:38:51 PM: go version go1.19.5 linux/amd64
12:38:51 PM: Using PHP version 8.0
12:38:52 PM: Downloading and installing node v16.4.2...
12:38:52 PM: Downloading https://nodejs.org/dist/v16.4.2/node-v16.4.2-linux-x64.tar.xz...
12:38:53 PM: Computing checksum with sha256sum
12:38:53 PM: Checksums matched!
12:38:55 PM: Now using node v16.4.2 (npm v7.18.1)
12:38:55 PM: Started restoring cached build plugins
12:38:55 PM: Finished restoring cached build plugins
12:38:55 PM: Started restoring cached corepack dependencies
12:38:55 PM: Finished restoring cached corepack dependencies
12:38:55 PM: No npm workspaces detected
12:38:55 PM: Started restoring cached node modules
12:38:55 PM: Finished restoring cached node modules
12:38:55 PM: Installing npm packages using npm version 7.18.1
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: '@jest/expect-utils@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-get-type@29.2.0',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: '@jest/schemas@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: '@jest/schemas@29.0.0',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: '@jest/types@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'diff-sequences@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'expect@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-diff@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-get-type@29.2.0',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-matcher-utils@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-message-util@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-util@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'pretty-format@29.3.1',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^14.15.0 || ^16.10.0 || >=18.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-worker@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: '@jest/console@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: '@jest/test-result@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: '@jest/types@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-message-util@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-regex-util@28.0.2',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-util@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'jest-watcher@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:38:56 PM: npm WARN EBADENGINE Unsupported engine {
12:38:56 PM: npm WARN EBADENGINE   package: 'pretty-format@28.1.3',
12:38:56 PM: npm WARN EBADENGINE   required: { node: '^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0' },
12:38:56 PM: npm WARN EBADENGINE   current: { node: 'v16.4.2', npm: '7.18.1' }
12:38:56 PM: npm WARN EBADENGINE }
12:39:01 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
12:39:02 PM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
12:39:02 PM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
12:39:06 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
12:39:11 PM: added 1483 packages, and audited 1484 packages in 16s
12:39:11 PM: 228 packages are looking for funding
12:39:11 PM:   run `npm fund` for details
12:39:11 PM: 7 high severity vulnerabilities
12:39:11 PM: To address issues that do not require attention, run:
12:39:11 PM:   npm audit fix
12:39:11 PM: To address all issues (including breaking changes), run:
12:39:11 PM:   npm audit fix --force
12:39:11 PM: Run `npm audit` for details.
12:39:11 PM: npm packages installed
12:39:11 PM: Python version set to 3.8
12:39:11 PM: Install dependencies script success
12:39:11 PM: Starting build script
12:39:11 PM: Using stage install dependencies
12:39:11 PM: Detected 1 framework(s)
12:39:11 PM: "create-react-app" at version "5.0.1"
12:39:11 PM: Section completed: initializing
12:39:13 PM: ​
12:39:13 PM:   Netlify Build                                                 
12:39:13 PM: ────────────────────────────────────────────────────────────────
12:39:13 PM: ​
12:39:13 PM: ❯ Version
12:39:13 PM:   @netlify/build 29.5.8
12:39:13 PM: ​
12:39:13 PM: ❯ Flags
12:39:13 PM:   baseRelDir: true
12:39:13 PM:   buildId: 63f50fa9e0b3ac00586b48a7
12:39:13 PM:   deployId: 63f50fa9e0b3ac00586b48a9
12:39:13 PM: ​
12:39:13 PM: ❯ Current directory
12:39:13 PM:   /opt/build/repo/frontend/perfumery2_client
12:39:13 PM: ​
12:39:13 PM: ❯ Config file
12:39:13 PM:   No config file was defined: using default values.
12:39:13 PM: ​
12:39:13 PM: ❯ Context
12:39:13 PM:   production
12:39:13 PM: ​
12:39:13 PM:   1. Build command from Netlify app                             
12:39:13 PM: ────────────────────────────────────────────────────────────────
12:39:13 PM: ​
12:39:13 PM: $ npm run build
12:39:13 PM: /opt/build/repo/node_modules/.bin/node: 1: Syntax error: "|" unexpected (expecting ")")
12:39:13 PM: ​
12:39:13 PM:   "build.command" failed                                        
12:39:13 PM: ────────────────────────────────────────────────────────────────
12:39:13 PM: ​
12:39:13 PM:   Error message
12:39:13 PM:   Command failed with exit code 2: npm run build (https://ntl.fyi/exit-code-2)
12:39:13 PM: ​
12:39:13 PM:   Error location
12:39:13 PM:   In Build command from Netlify app:
12:39:13 PM:   npm run build
12:39:13 PM: ​
12:39:13 PM:   Resolved config
12:39:14 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:39:13 PM:   build:
12:39:13 PM:     base: /opt/build/repo/frontend/perfumery2_client
12:39:13 PM:     command: npm run build
12:39:13 PM:     commandOrigin: ui
12:39:13 PM:     environment:
12:39:13 PM:       - CI
12:39:13 PM:       - NODE_VERSION
12:39:13 PM:     publish: /opt/build/repo/frontend/perfumery2_client/build
12:39:13 PM:     publishOrigin: ui
12:39:13 PM:   redirects:
12:39:13 PM:     - from: /*
      status: 200
      to: /index.html
Caching artifacts
12:39:13 PM: Started saving node modules
12:39:13 PM: Finished saving node modules
12:39:13 PM: Started saving build plugins
12:39:13 PM: Finished saving build plugins
12:39:13 PM: Started saving corepack cache
12:39:13 PM: Finished saving corepack cache
12:39:13 PM: Started saving pip cache
12:39:13 PM: Finished saving pip cache
12:39:13 PM: Started saving emacs cask dependencies
12:39:13 PM: Finished saving emacs cask dependencies
12:39:13 PM: Started saving maven dependencies
12:39:13 PM: Finished saving maven dependencies
12:39:13 PM: Started saving boot dependencies
12:39:13 PM: Finished saving boot dependencies
12:39:13 PM: Started saving rust rustup cache
12:39:13 PM: Finished saving rust rustup cache
12:39:13 PM: Started saving go dependencies
12:39:13 PM: Finished saving go dependencies
12:39:14 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:39:14 PM: Failing build: Failed to build site
12:39:14 PM: Finished processing build request in 35.704s"

I don’t see the site anymore. Does it exist?

Hello, I deleted it yesterday and built it again as a new site to see if anything would change. Error is still the same

Here is the new site: Netlify App

Build log:

1:05:26 AM: build-image version: c0621868af5001023389eeaa9dbfbbaf313f67e2 (focal)
1:05:26 AM: buildbot version: c0621868af5001023389eeaa9dbfbbaf313f67e2
1:05:27 AM: Fetching cached dependencies
1:05:27 AM: Failed to fetch cache, continuing with build
1:05:27 AM: Starting to prepare the repo for build
1:05:27 AM: No cached dependencies found. Cloning fresh repo
1:05:27 AM: git clone --filter=blob:none https://github.com/enwumeh/perfumery2
1:05:27 AM: Preparing Git Reference refs/heads/main
1:05:30 AM: Parsing package.json dependencies
1:05:31 AM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'frontend/perfumery2_client' versus 'frontend/perfumery2_client/' in the Netlify UI
1:05:31 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'frontend/perfumery2_client/build' versus 'build' in the Netlify UI
1:05:31 AM: Starting build script
1:05:31 AM: Installing dependencies
1:05:31 AM: Python version set to 2.7
1:05:31 AM: v16.19.1 is already installed.
1:05:32 AM: Now using node v16.19.1 (npm v8.19.3)
1:05:32 AM: Enabling Node.js Corepack
1:05:32 AM: Started restoring cached build plugins
1:05:32 AM: Finished restoring cached build plugins
1:05:32 AM: Attempting Ruby version 2.7.2, read from environment
1:05:32 AM: Using Ruby version 2.7.2
1:05:33 AM: Using PHP version 8.0
1:05:33 AM: Started restoring cached corepack dependencies
1:05:33 AM: Finished restoring cached corepack dependencies
1:05:33 AM: No npm workspaces detected
1:05:33 AM: Started restoring cached node modules
1:05:33 AM: Finished restoring cached node modules
1:05:33 AM: Installing npm packages using npm version 8.19.3
1:05:37 AM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
1:05:37 AM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
1:05:37 AM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
1:05:39 AM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
1:05:44 AM: added 1483 packages, and audited 1484 packages in 11s
1:05:44 AM: 228 packages are looking for funding
1:05:44 AM:   run `npm fund` for details
1:05:44 AM: 7 high severity vulnerabilities
1:05:44 AM: To address issues that do not require attention, run:
1:05:44 AM:   npm audit fix
1:05:44 AM: To address all issues (including breaking changes), run:
1:05:44 AM:   npm audit fix --force
1:05:44 AM: Run `npm audit` for details.
1:05:44 AM: npm packages installed
1:05:45 AM: Started restoring cached go cache
1:05:45 AM: Finished restoring cached go cache
1:05:45 AM: go version go1.19.6 linux/amd64
1:05:45 AM: Detected 1 framework(s)
1:05:45 AM: "create-react-app" at version "5.0.1"
1:05:45 AM: Section completed: initializing
1:05:46 AM: ​
1:05:46 AM:   Netlify Build                                                 
1:05:46 AM: ────────────────────────────────────────────────────────────────
1:05:46 AM: ​
1:05:46 AM: ❯ Version
1:05:46 AM:   @netlify/build 29.5.8
1:05:46 AM: ​
1:05:46 AM: ❯ Flags
1:05:46 AM:   baseRelDir: true
1:05:46 AM:   buildId: 63fb04b525c1253613f01de8
1:05:46 AM:   deployId: 63fb04b525c1253613f01dea
1:05:46 AM: ​
1:05:46 AM: ❯ Current directory
1:05:46 AM:   /opt/build/repo/frontend/perfumery2_client
1:05:46 AM: ​
1:05:46 AM: ❯ Config file
1:05:46 AM:   No config file was defined: using default values.
1:05:46 AM: ​
1:05:46 AM: ❯ Context
1:05:46 AM:   production
1:05:46 AM: ​
1:05:46 AM:   1. Build command from Netlify app                             
1:05:46 AM: ────────────────────────────────────────────────────────────────
1:05:46 AM: ​
1:05:46 AM: $ npm run build
1:05:46 AM: /opt/build/repo/node_modules/.bin/node: 1: Syntax error: "|" unexpected (expecting ")")
1:05:46 AM: ​
1:05:46 AM:   "build.command" failed                                        
1:05:46 AM: ────────────────────────────────────────────────────────────────
1:05:46 AM: ​
1:05:46 AM:   Error message
1:05:46 AM:   Command failed with exit code 2: npm run build (https://ntl.fyi/exit-code-2)
1:05:46 AM: ​
1:05:46 AM:   Error location
1:05:46 AM:   In Build command from Netlify app:
1:05:46 AM:   npm run build
1:05:46 AM: ​
1:05:48 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:05:46 AM:   Resolved config
1:05:46 AM:   build:
1:05:46 AM:     base: /opt/build/repo/frontend/perfumery2_client
1:05:46 AM:     command: npm run build
1:05:46 AM:     commandOrigin: ui
1:05:46 AM:     publish: /opt/build/repo/frontend/perfumery2_client/build
1:05:46 AM:     publishOrigin: ui
1:05:46 AM:   redirects:
1:05:47 AM:     - from: /*
      status: 200
      to: /index.html
Caching artifacts
1:05:47 AM: Started saving node modules
1:05:47 AM: Finished saving node modules
1:05:47 AM: Started saving build plugins
1:05:47 AM: Finished saving build plugins
1:05:47 AM: Started saving corepack cache
1:05:47 AM: Finished saving corepack cache
1:05:47 AM: Started saving pip cache
1:05:47 AM: Finished saving pip cache
1:05:47 AM: Started saving emacs cask dependencies
1:05:47 AM: Finished saving emacs cask dependencies
1:05:47 AM: Started saving maven dependencies
1:05:47 AM: Finished saving maven dependencies
1:05:47 AM: Started saving boot dependencies
1:05:47 AM: Finished saving boot dependencies
1:05:47 AM: Started saving rust rustup cache
1:05:47 AM: Finished saving rust rustup cache
1:05:47 AM: Started saving go dependencies
1:05:47 AM: Finished saving go dependencies
1:05:48 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:05:48 AM: Failing build: Failed to build site
1:05:48 AM: Finished processing build request in 21.535s```

Hiya @emman1 ,

Thanks for sharing the new site link! Are you able to build locally? The first steps to fixing any build error is to be sure that you can build in your local development environment.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

Please keep us posted!

Hi,
I looked carefully over all the resources, and tried basically everything that I understood, which seemed to apply to me (5, 10, 11 from Tidbits to look into further from Netlify build tips article , and others from the compiled build and deploy resource. I added the NETLIFY_BUILD_DEBUG environment variable also. So far nothing has worked and the same error after each attempt at building

Latest build log

2:37:26 PM: build-image version: c1f0e3189beff44ebec7048bf7ab2e75cb09660b (focal)
2:37:26 PM: buildbot version: c1f0e3189beff44ebec7048bf7ab2e75cb09660b
2:37:26 PM: Fetching cached dependencies
2:37:26 PM: Failed to fetch cache, continuing with build
2:37:26 PM: Starting to prepare the repo for build
2:37:26 PM: No cached dependencies found. Cloning fresh repo
2:37:26 PM: git clone --filter=blob:none https://github.com/enwumeh/perfumery2
2:37:27 PM: Preparing Git Reference refs/heads/main
2:37:29 PM: Parsing package.json dependencies
2:37:30 PM: 
​
❯ Initial build environment
baseRelDir: true
branch: main
context: production
cwd: /opt/build/repo
featureFlags: []
mode: buildbot
repositoryRoot: /opt/build/repo
siteId: 2d63d72a-6336-4261-b62a-fde6daa29c2e
​
❯ UI build settings
baseRelDir: true
build:
  base: frontend/perfumery2_client/
  command: npm run build
  environment:
    - NETLIFY_BUILD_DEBUG
  publish: build
​
❯ Resolved build environment
branch: main
buildDir: /opt/build/repo/frontend/perfumery2_client
context: production
env: []
​
❯ Resolved config
build:
  base: /opt/build/repo/frontend/perfumery2_client
  command: npm run build
  commandOrigin: ui
  environment:
    - NETLIFY_BUILD_DEBUG
  publish: /opt/build/repo/frontend/perfumery2_client/build
  publishOrigin: ui
redirects:
  - from: /*
    status: 200
    to: /index.html

2:37:30 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'frontend/perfumery2_client' versus 'frontend/perfumery2_client/' in the Netlify UI
2:37:30 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'frontend/perfumery2_client/build' versus 'build' in the Netlify UI
2:37:31 PM: Starting build script
2:37:31 PM: Installing dependencies
2:37:31 PM: Python version set to 2.7
2:37:31 PM: v16.19.1 is already installed.
2:37:31 PM: Now using node v16.19.1 (npm v8.19.3)
2:37:31 PM: Enabling Node.js Corepack
2:37:32 PM: Started restoring cached build plugins
2:37:32 PM: Finished restoring cached build plugins
2:37:32 PM: Attempting Ruby version 2.7.2, read from environment
2:37:32 PM: Using Ruby version 2.7.2
2:37:32 PM: Using PHP version 8.0
2:37:32 PM: Started restoring cached corepack dependencies
2:37:32 PM: Finished restoring cached corepack dependencies
2:37:33 PM: No npm workspaces detected
2:37:33 PM: Started restoring cached node modules
2:37:33 PM: Finished restoring cached node modules
2:37:33 PM: Installing npm packages using npm version 8.19.3
2:37:37 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
2:37:37 PM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
2:37:37 PM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
2:37:39 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
2:37:44 PM: added 1484 packages, and audited 1485 packages in 11s
2:37:44 PM: 228 packages are looking for funding
2:37:44 PM:   run `npm fund` for details
2:37:44 PM: 7 high severity vulnerabilities
2:37:44 PM: To address issues that do not require attention, run:
2:37:44 PM:   npm audit fix
2:37:44 PM: To address all issues (including breaking changes), run:
2:37:44 PM:   npm audit fix --force
2:37:44 PM: Run `npm audit` for details.
2:37:44 PM: npm packages installed
2:37:44 PM: Started restoring cached go cache
2:37:44 PM: Finished restoring cached go cache
2:37:44 PM: go version go1.19.6 linux/amd64
2:37:45 PM: Detected 1 framework(s)
2:37:45 PM: "create-react-app" at version "5.0.1"
2:37:45 PM: Section completed: initializing
2:37:46 PM: ​
2:37:46 PM:   Netlify Build                                                 
2:37:46 PM: ────────────────────────────────────────────────────────────────
2:37:46 PM: ​
2:37:46 PM: ❯ Version
2:37:46 PM:   @netlify/build 29.5.8
2:37:46 PM: ​
2:37:46 PM: ❯ Flags
2:37:46 PM:   apiHost: api.netlify.com
2:37:46 PM:   baseRelDir: true
2:37:46 PM:   branch: main
2:37:46 PM:   buildId: 64025a7e1f961b0008c2e8e7
2:37:46 PM:   buildbotServerSocket: /tmp/netlify-buildbot-socket
2:37:46 PM:   cacheDir: /opt/build/cache
2:37:46 PM:   cachedConfigPath: /tmp/netlify_config.json
2:37:46 PM:   context: production
2:37:46 PM:   cwd: /opt/build/repo
2:37:46 PM:   deployId: 64025a7e1f961b0008c2e8e9
2:37:46 PM:   edgeFunctionsDistDir: /tmp/edge-64025a7e1f961b0008c2e8e9
2:37:46 PM:   featureFlags:
2:37:46 PM:     - edge_functions_cache_cli
2:37:46 PM:     - edge_functions_system_logger
2:37:46 PM:   framework: create-react-app
2:37:46 PM:   functionsDistDir: /tmp/zisi-64025a7e1f961b0008c2e8e9
2:37:46 PM:   mode: buildbot
2:37:46 PM:   nodePath: /opt/buildhome/.nvm/versions/node/v16.19.1/bin/node
2:37:46 PM:   repositoryRoot: /opt/build/repo
2:37:46 PM:   saveConfig: true
2:37:46 PM:   sendStatus: true
2:37:46 PM:   siteId: 2d63d72a-6336-4261-b62a-fde6daa29c2e
2:37:46 PM:   statsd:
2:37:46 PM:     host: 10.65.17.161
2:37:46 PM:     port: 8125
2:37:46 PM:   systemLogFile: 3
2:37:46 PM:   testOpts:
2:37:46 PM:     silentLingeringProcesses: ''
2:37:46 PM: ​
2:37:46 PM: ❯ Current directory
2:37:46 PM:   /opt/build/repo/frontend/perfumery2_client
2:37:48 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
2:37:46 PM: ​
2:37:46 PM: ❯ Config file
2:37:46 PM:   No config file was defined: using default values.
2:37:46 PM: ​
2:37:46 PM: ❯ Resolved config
2:37:46 PM:   build:
2:37:46 PM:     base: /opt/build/repo/frontend/perfumery2_client
2:37:46 PM:     command: npm run build
2:37:46 PM:     commandOrigin: ui
2:37:46 PM:     environment:
2:37:46 PM:       - NETLIFY_BUILD_DEBUG
2:37:46 PM:     publish: /opt/build/repo/frontend/perfumery2_client/build
2:37:46 PM:     publishOrigin: ui
2:37:46 PM:   redirects:
2:37:46 PM:     - from: /*
      status: 200
      to: /index.html
​
2:37:46 PM: ❯ Context
2:37:46 PM:   production
2:37:46 PM: ​
2:37:46 PM:   1. Build command from Netlify app                             
2:37:46 PM: ────────────────────────────────────────────────────────────────
2:37:46 PM: ​
2:37:46 PM: $ npm run build
2:37:46 PM: /opt/build/repo/node_modules/.bin/node: 1: Syntax error: "|" unexpected (expecting ")")
2:37:46 PM: ​
2:37:46 PM:   "build.command" failed                                        
2:37:46 PM: ────────────────────────────────────────────────────────────────
2:37:46 PM: ​
2:37:46 PM:   Error message
2:37:46 PM:   Command failed with exit code 2: npm run build (https://ntl.fyi/exit-code-2)
2:37:46 PM: ​
2:37:46 PM:   Error location
2:37:46 PM:   In Build command from Netlify app:
2:37:46 PM:   npm run build
2:37:46 PM: ​
2:37:46 PM:   Resolved config
2:37:46 PM:   build:
2:37:46 PM:     base: /opt/build/repo/frontend/perfumery2_client
2:37:46 PM:     command: npm run build
2:37:46 PM:     commandOrigin: ui
2:37:46 PM:     environment:
2:37:46 PM:       - NETLIFY_BUILD_DEBUG
2:37:46 PM:     publish: /opt/build/repo/frontend/perfumery2_client/build
2:37:46 PM:     publishOrigin: ui
2:37:46 PM:   redirects:
2:37:47 PM:     - from: /*
      status: 200
      to: /index.html
Caching artifacts
2:37:47 PM: Started saving node modules
2:37:47 PM: Finished saving node modules
2:37:47 PM: Started saving build plugins
2:37:47 PM: Finished saving build plugins
2:37:47 PM: Started saving corepack cache
2:37:47 PM: Finished saving corepack cache
2:37:47 PM: Started saving pip cache
2:37:47 PM: Finished saving pip cache
2:37:47 PM: Started saving emacs cask dependencies
2:37:47 PM: Finished saving emacs cask dependencies
2:37:47 PM: Started saving maven dependencies
2:37:47 PM: Finished saving maven dependencies
2:37:47 PM: Started saving boot dependencies
2:37:47 PM: Finished saving boot dependencies
2:37:47 PM: Started saving rust rustup cache
2:37:47 PM: Finished saving rust rustup cache
2:37:47 PM: Started saving go dependencies
2:37:47 PM: Finished saving go dependencies
2:37:48 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:37:48 PM: Failing build: Failed to build site
2:37:48 PM: Finished processing build request in 22.345s```

Do you think you can share the repo for us to check?

https://github.com/enwumeh/perfumery2

@emman1 The repository that you’ve linked to appears to be private, can you change the visibility to Public?

Changed, sorry about that

hi

These type of errors are typically seen when one commits the node_modules like you’re doing:

If removing that does not do the trick, try removing the package-lock.json and try again!

After deleting, don’t forget to add it to the .gitignore and push the changes.

hope that helps!

That did it, I deleted my node_modules from my main directory and my site is now live. Thank you!

1 Like

Hi @emman1 :wave:t6: ,

Thanks for coming back and letting us know you found your solution!

1 Like