12:22:23 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2) Command failed with exit code 1: CI= npm run build

I haven’t had any issues with CI = npm run build command. But this is the first time; I am having this error. Cheers!

12:22:20 PM: Netlify Build
12:22:20 PM: ────────────────────────────────────────────────────────────────
12:22:20 PM: ​
12:22:20 PM: ❯ Version
12:22:20 PM: @netlify/build 29.19.0
12:22:20 PM: ​
12:22:20 PM: ❯ Flags
12:22:20 PM: baseRelDir: true
12:22:20 PM: buildId: 64d5e18b0445723420a6b95f
12:22:20 PM: deployId: 64d5e18b0445723420a6b961
12:22:20 PM: ​
12:22:20 PM: ❯ Current directory
12:22:20 PM: /opt/build/repo
12:22:20 PM: ​
12:22:20 PM: ❯ Config file
12:22:20 PM: No config file was defined: using default values.
12:22:20 PM: ​
12:22:20 PM: ❯ Context
12:22:20 PM: production
12:22:20 PM: ​
12:22:20 PM: Build command from Netlify app
12:22:20 PM: ────────────────────────────────────────────────────────────────
12:22:20 PM: ​
12:22:21 PM: $ CI= npm run build
12:22:21 PM: npm ERR! Missing script: build
12:22:21 PM: npm ERR!
12:22:21 PM: npm ERR! To see a list of scripts, run:
12:22:23 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
12:22:21 PM: npm ERR! npm run
12:22:21 PM: npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2023-08-11T07_22_21_173Z-debug-0.log
12:22:21 PM: ​
12:22:21 PM: build.command failed
12:22:21 PM: ────────────────────────────────────────────────────────────────
12:22:21 PM: ​
12:22:21 PM: Error message
12:22:21 PM: Command failed with exit code 1: CI= npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
12:22:21 PM: ​
12:22:21 PM: Error location
12:22:21 PM: In Build command from Netlify app:
12:22:21 PM: CI= npm run build
12:22:21 PM: ​
12:22:21 PM: Resolved config
12:22:21 PM: build:
12:22:21 PM: command: CI= npm run build
12:22:21 PM: commandOrigin: ui
12:22:21 PM: publish: /opt/build/repo
12:22:21 PM: publishOrigin: default
12:22:22 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:22:23 PM: Failing build: Failed to build site
12:22:23 PM: Finished processing build request in 25.436s

What site is this for?

@SamO It’s a CRM project, for FYP of university

sorry, I should have clarified. You have 4 different sites on your account. Which one our of the four is failing to build?

@SamO
The https://dymaxtechcrm.netlify.app/ " dymaxtechcrm" is failing to build.

Your package.json doesn’t have a script named build. You need to add that.

Now its showing this error. Is it a netlify’s build command issue or something to do with my code?

12:13:01 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
12:13:00 PM: npm WARN tarball tarball data for postcss-minify-params@https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-4.0.2.tgz (sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhproposal/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg==) seems to be corrupted. Trying again.
12:13:00 PM: npm ERR! code EINTEGRITY
12:13:00 PM: npm ERR! sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhproposal/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg== integrity checksum failed when using sha512: wanted sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhproposal/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg== but got sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhPet/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg==. (2737 bytes)
12:13:00 PM: npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2023-08-22T07_11_44_748Z-debug-0.log
12:13:00 PM: ​
12:13:00 PM: build.command failed
12:13:00 PM: ────────────────────────────────────────────────────────────────
12:13:00 PM: ​
12:13:00 PM: Error message
12:13:00 PM: Command failed with exit code 1: CI= npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
12:13:00 PM: ​
12:13:00 PM: Error location
12:13:00 PM: In Build command from Netlify app:
12:13:00 PM: CI= npm run build
12:13:00 PM: ​
12:13:00 PM: Resolved config
12:13:00 PM: build:
12:13:00 PM: command: CI= npm run build
12:13:00 PM: commandOrigin: ui
12:13:00 PM: publish: /opt/build/repo
12:13:00 PM: publishOrigin: default
12:13:01 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:13:01 PM: Failing build: Failed to build site
12:13:02 PM: Finished processing build request in 1m35.592s

Your latest deploy seems to have worked. Do you still need help?

Yeah the build was successful but I’m getting this error when I’m trying to access the link:

Page Not Found

Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.

Back to our site


If this is your site, and you weren’t expecting a 404 for this path, please visit Netlify’s “page not found” support guide for troubleshooting tips.

One thing I would like to add that it’s a MERN Stack application and the backend is the main directory and the frontend is in the frontend folder

You’ve deleted the build command fromsite settings: Build & deploy | Site configuration | dymaxtechcrm | Netlify. You need to set a command to build your site.

If I add the cl=npm run build it shows the previous error.

You need to

  1. add the build command
  2. check this guide on how to resolve the page not found error: [Support Guide] I’ve deployed my site but I still see "Page not found”