Hi, I don’t usually encounter issues like this, but it appears that netlify is not running the npm install
command when I deploy my application.
I need to find a way to force the installation of node modules.
Here are some details, I’m using Node version v16.19.0, and when I ran the command ```npm run build``, it works perfectly.
This is the same error that keeps popping up,
10:59:51 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
10:59:50 PM: Netlify Build
10:59:50 PM: ────────────────────────────────────────────────────────────────
10:59:50 PM:
10:59:50 PM: ❯ Version
10:59:50 PM: @netlify/build 29.12.1
10:59:50 PM:
10:59:50 PM: ❯ Flags
10:59:50 PM: baseRelDir: true
10:59:50 PM: buildId: 648e2cc7b066370008606bfb
10:59:50 PM: deployId: 648e2cc7b066370008606bfd
10:59:50 PM:
10:59:50 PM: ❯ Current directory
10:59:50 PM: /opt/build/repo/src
10:59:50 PM:
10:59:50 PM: ❯ Config file
10:59:50 PM: /opt/build/repo/netlify.toml
10:59:50 PM:
10:59:50 PM: ❯ Context
10:59:50 PM: production
10:59:50 PM:
10:59:50 PM: Build command from Netlify app
10:59:50 PM: ────────────────────────────────────────────────────────────────
10:59:50 PM:
10:59:50 PM: $ npm run build
10:59:50 PM: > bitcoin-savings@1.1.0 build
10:59:50 PM: > react-scripts build
10:59:50 PM: sh: 1: react-scripts: not found
10:59:50 PM:
10:59:50 PM: build.command failed
10:59:50 PM: ────────────────────────────────────────────────────────────────
10:59:50 PM:
10:59:50 PM: Error message
10:59:50 PM: Command failed with exit code 127: npm run build (https://ntl.fyi/exit-code-127)
10:59:50 PM:
10:59:50 PM: Error location
10:59:50 PM: In Build command from Netlify app:
10:59:50 PM: npm run build
10:59:50 PM:
10:59:50 PM: Resolved config
10:59:50 PM: build:
10:59:50 PM: base: /opt/build/repo/src
10:59:50 PM: command: npm run build
10:59:50 PM: commandOrigin: ui
10:59:50 PM: environment:
10:59:50 PM: - CI
10:59:50 PM: publish: /opt/build/repo/src/build
10:59:50 PM: publishOrigin: config
10:59:50 PM: redirects:
10:59:51 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:59:51 PM: Failing build: Failed to build site
10:59:51 PM: Finished processing build request in 14.433s
I added a variable manually, I set CI
to false, chatgtp suggests that could force it to install the dependencies, but that did nothing. I also changed “CI= npm run build”, to “npm run build”.
My netlify app URL is https://bitcoinsavings.netlify.app/. Any help please.