As I'am trying to deploy my site through netlify I always getting the following error. Until no solution has worked for me.
Tried to set a new Environment setting variable "CI false". Now I'm a bit lost.
Hope there is anyone who can help me out.
7:53:34 PM: ────────────────────────────────────────────────────────────────
7:53:34 PM: "build.command" failed
7:53:34 PM: ────────────────────────────────────────────────────────────────
7:53:34 PM:
7:53:34 PM: Error message
7:53:34 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
7:53:34 PM:
7:53:34 PM: Error location
7:53:34 PM: In Build command from Netlify app:
7:53:34 PM: npm run build
7:53:34 PM:
7:53:34 PM: Resolved config
7:53:34 PM: build:
7:53:34 PM: command: npm run build
7:53:34 PM: commandOrigin: ui
7:53:34 PM: environment:
7:53:34 PM: - CI
7:53:34 PM: - NEXT_PRIVATE_TARGET
7:53:34 PM: publish: /opt/build/repo/.next
7:53:34 PM: publishOrigin: ui
7:53:34 PM: plugins:
7:53:34 PM: - inputs: {}
7:53:34 PM: origin: ui
7:53:34 PM: package: '@netlify/plugin-nextjs'
7:53:34 PM: Caching artifacts
7:53:34 PM: Started saving node modules
7:53:34 PM: Finished saving node modules
7:53:34 PM: Started saving build plugins
7:53:34 PM: Finished saving build plugins
7:53:34 PM: Started saving pip cache
7:53:34 PM: Finished saving pip cache
7:53:34 PM: Started saving emacs cask dependencies
7:53:34 PM: Finished saving emacs cask dependencies
7:53:34 PM: Started saving maven dependencies
7:53:34 PM: Finished saving maven dependencies
7:53:34 PM: Started saving boot dependencies
7:53:34 PM: Finished saving boot dependencies
7:53:34 PM: Started saving rust rustup cache
7:53:34 PM: Finished saving rust rustup cache
7:53:34 PM: Started saving go dependencies
7:53:34 PM: Finished saving go dependencies
7:53:35 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:53:35 PM: Creating deploy upload records
7:53:35 PM: Failing build: Failed to build site
7:53:35 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
7:53:35 PM: Finished processing build request in 48.628409133s
For better understanding I will add my package.json file down below as well.
{
"name": "cryptocheck24",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@heroicons/react": "^2.0.10",
"@portabletext/react": "^1.0.6",
"@sanity/client": "^3.3.6",
"@sanity/image-url": "^1.0.1",
"flowbite": "^1.5.3",
"flowbite-react": "^0.1.11",
"groq": "^2.29.3",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"tippy.js": "^6.3.7"
},
"devDependencies": {
"autoprefixer": "^10.4.8",
"eslint": "8.23.0",
"eslint-config-next": "12.2.5",
"postcss": "^8.4.16",
"tailwindcss": "^3.1.8"
}
}