Build script returned non-zero exit code: 127 build error yarn.lock file missing

Apologies for the lengthy message, but this is my deploy log - Has anyone else run into this error? Preventing me from deploying site, and not sure how to fix!

11:46:21 PM: Started saving emacs cask dependencies

11:46:21 PM: Finished saving emacs cask dependencies

11:46:21 PM: Started saving maven dependencies

11:46:21 PM: Finished saving maven dependencies

11:46:21 PM: Started saving boot dependencies

11:46:21 PM: Finished saving boot dependencies

11:46:21 PM: Started saving go dependencies

11:46:21 PM: Finished saving go dependencies

11:46:25 PM: Error running command: Build script returned non-zero exit code: 127

11:46:25 PM: Failing build: Failed to build site

11:46:25 PM: failed during stage β€˜building site’: Build script returned non-zero exit code: 127

11:46:25 PM: Finished processing build request in 2m30.307038628s

11:46:25 PM: Shutting down logging, 0 messages pending

In most cases, when I get exit code: 127 is was due to the build command being invalid.

Hi Talves, thank you for your response. I am beginner on it. How do I find the correct command?

It is the one you would use to build local, when you test if a build works correctly. What static site generator are you using?

it working on localhost - just using react with yarn build – this is my package.json file - is that helpful?

 "name": "xxx",

β€œversion”: β€œ2.1.1”,
β€œprivate”: true,
β€œscripts”: {
β€œstart”: β€œreact-app-rewired start”,
β€œbuild”: β€œreact-app-rewired build”,
β€œtest”: β€œreact-app-rewired test”,
β€œlint-staged”: β€œlint-staged”,
β€œprettier”: β€œprettier --write β€œsrc//*.{js,jsx,ts,tsx,scss,less}"",
β€œeslint”: β€œeslint --ext .js,jsx src”,
β€œtslint”: "tslint "src/
/.{ts,tsx}"",
β€œstylelint”: "stylelint "src/**/
.{scss,less}””
},
β€œhusky”: {
β€œhooks”: {
β€œpre-commit”: β€œnpm run lint-staged”
}
},
β€œlint-staged”: {
β€œsrc//*.{js,jsx,ts,tsx,scss,less}": [
β€œprettier --write”,
β€œgit add”
],
"src/
/.{js,jsx}": [
β€œeslint”
],
"src/**/
.{scss,less}”: [
β€œstylelint”
]
},
β€œdependencies”: {
β€œ@rowno/sparkline”: β€œ^3.0.1”,
β€œantd”: β€œ^3.13.2”,
β€œbootstrap-css-only”: β€œ^4.2.1”,
β€œchart.js”: β€œ^2.7.3”,
β€œchartist”: β€œ^0.11.0”,
β€œchartist-plugin-tooltips-updated”: β€œ^0.0.20”,
β€œclassnames”: β€œ^2.2.6”,
β€œconnected-react-router”: β€œ^6.3.1”,
β€œd3-dsv”: β€œ^1.1.1”,
β€œd3-format”: β€œ^1.3.2”,
β€œd3-time-format”: β€œ^2.1.3”,
β€œenquire-js”: β€œ^0.2.1”,
β€œfirebase”: β€œ^5.8.2”,
β€œhistory”: β€œ^4.7.2”,
β€œlodash”: β€œ^4.17.11”,
β€œnprogress”: β€œ^0.2.0”,
β€œpeity-react”: β€œ^0.0.7”,
β€œprop-types”: β€œ^15.7.1”,
β€œqs”: β€œ^6.6.0”,
β€œrc-drawer”: β€œ^1.7.7”,
β€œreact”: β€œ^16.8.1”,
β€œreact-c3js”: β€œ^0.1.20”,
β€œreact-chartist”: β€œ^0.13.3”,
β€œreact-chartjs-2”: β€œ^2.7.4”,
β€œreact-custom-scrollbars”: β€œ^4.2.1”,
β€œreact-dom”: β€œ^16.8.1”,
β€œreact-draft-wysiwyg”: β€œ^1.13.1”,
β€œreact-helmet”: β€œ^5.2.0”,
β€œreact-intl”: β€œ^2.8.0”,
β€œreact-loadable”: β€œ^5.5.0”,
β€œreact-redux”: β€œ^6.0.0”,
β€œreact-redux-spinner”: β€œ^2.0.0”,
β€œreact-router”: β€œ^4.3”,
β€œreact-router-dom”: β€œ^4.3.1”,
β€œreact-router-redux”: β€œ^4.0.8”,
β€œreact-scripts”: β€œ2.1.5”,
β€œreact-stockcharts”: β€œ^0.7.8”,
β€œredux”: β€œ^4.0.1”,
β€œredux-logger”: β€œ^3.0.6”,
β€œredux-saga”: β€œ^1.0.1”,
β€œredux-thunk”: β€œ^2.3.0”,
β€œstore”: β€œ^2.0.12”
},
β€œdevDependencies”: {
β€œ@babel/plugin-proposal-decorators”: β€œ^7.3.0”,
β€œbabel-plugin-import”: β€œ^1.11.0”,
β€œcustomize-cra”: β€œ^0.2.11”,
β€œeslint-config-airbnb”: β€œ^17.1.0”,
β€œeslint-config-prettier”: β€œ^4.0.0”,
β€œhusky”: β€œ^1.3.1”,
β€œless”: β€œ^3.9.0”,
β€œless-loader”: β€œ^4.1.0”,
β€œlint-staged”: β€œ^8.1.3”,
β€œnode-sass”: β€œ^4.11.0”,
β€œreact-app-rewired”: β€œ^2.1.0”,
β€œstylelint”: β€œ^9.10.1”,
β€œstylelint-config-prettier”: β€œ^4.0.0”,
β€œstylelint-config-standard”: β€œ^18.2.0”
},
β€œbrowserslist”: [
β€œ>0.2%”,
β€œnot dead”,
β€œnot ie <= 11”,
β€œnot op_mini all”
]
}

So your build command is yarn build. If that is what you have as your build command, then it is something else that is wrong. You should have your publish directory should be set to build.

do I need to type anything for base directory?

No, not unless your project is not in the root.

Have you tried without the / at the end of the directory? The error is saying you have an issue with the build command.

Here is another guess. Are you pushing your yarn.lock file into the repository?

Netlify uses it to know to setup yarn in the build. see here

You gotta be kidding me :slight_smile: it just working right now. I’ve just uploaded yarn.lock file to github manually and then it worked. Thank you so much talves :slight_smile:

1 Like

So, I think we should mark it as solved, and change the title to β€œNetlify build error when yarn.lock file missing” :stuck_out_tongue_winking_eye: I am in the habit of submitting my yarn.lock, so I did not think of it right away until I saw your build command.

THANK YOU @talves !!

1 Like

Hey @talves I have pushed yarn.lock but still getting 127 build error

12:34:43 PM: build-image version: 6c82004ef0368b3a0232c6837cead23188bb347e (focal)
12:34:43 PM: buildbot version: 0dfbdb6e6e614fd26450cfc6bacb47c4c6fd9626
12:34:43 PM: Fetching cached dependencies
12:34:43 PM: Failed to fetch cache, continuing with build
12:34:43 PM: Starting to prepare the repo for build
12:34:43 PM: No cached dependencies found. Cloning fresh repo
12:34:43 PM: git clone --filter=blob:none https://github.com/Shivam-vishwakarma991/Website-Portfolio
12:34:43 PM: Preparing Git Reference refs/heads/main
12:34:44 PM: Parsing package.json dependencies
12:34:45 PM: Starting to install dependencies
12:34:45 PM: Started restoring cached go cache
12:34:45 PM: Finished restoring cached go cache
12:34:45 PM: Installing Go version 1.19.5 (requested 1.19.5)
12:34:50 PM: go version go1.19.5 linux/amd64
12:34:50 PM: v16.20.0 is already installed.
12:34:50 PM: Now using node v16.20.0 (npm v8.19.4)
12:34:50 PM: Enabling Node.js Corepack
12:34:50 PM: Started restoring cached build plugins
12:34:50 PM: Finished restoring cached build plugins
12:34:50 PM: Started restoring cached corepack dependencies
12:34:51 PM: Finished restoring cached corepack dependencies
12:34:51 PM: Started restoring cached yarn cache
12:34:51 PM: Finished restoring cached yarn cache
12:34:51 PM: No yarn workspaces detected
12:34:51 PM: Started restoring cached node modules
12:34:51 PM: Finished restoring cached node modules
12:34:51 PM: Installing npm packages using Yarn version 1.22.19
12:34:51 PM: yarn install v1.22.19
12:34:51 PM: [1/4] Resolving packages...
12:34:51 PM: [2/4] Fetching packages...
12:35:01 PM: [3/4] Linking dependencies...
12:35:01 PM: warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
12:35:02 PM: [4/4] Building fresh packages...
12:35:02 PM: Done in 10.63s.
12:35:02 PM: npm packages installed using Yarn
12:35:02 PM: Python version set to 3.8
12:35:02 PM: Attempting Ruby version 2.7.2, read from environment
12:35:03 PM: Using Ruby version 2.7.2
12:35:04 PM: Using PHP version 8.0
12:35:04 PM: Install dependencies script success
12:35:04 PM: Starting build script
12:35:05 PM: Using stage install dependencies
12:35:05 PM: Detected 1 framework(s)
12:35:05 PM: "next" at version "13.2.4"
12:35:05 PM: Section completed: initializing
12:35:06 PM: ​
12:35:06 PM:   Netlify Build                                                 
12:35:06 PM: ────────────────────────────────────────────────────────────────
12:35:06 PM: ​
12:35:06 PM: ❯ Version
12:35:06 PM:   @netlify/build 29.9.0
12:35:06 PM: ​
12:35:06 PM: ❯ Flags
12:35:06 PM:   baseRelDir: true
12:35:06 PM:   buildId: 6427d755c4987300082d87fb
12:35:06 PM:   deployId: 6427d755c4987300082d87fd
12:35:07 PM: ​
12:35:07 PM: ❯ Current directory
12:35:07 PM:   /opt/build/repo
12:35:07 PM: ​
12:35:07 PM: ❯ Config file
12:35:07 PM:   No config file was defined: using default values.
12:35:07 PM: ​
12:35:07 PM: ❯ Context
12:35:07 PM:   production
12:35:07 PM: ​
12:35:07 PM: ❯ Installing plugins
12:35:07 PM:    - @netlify/plugin-nextjs@4.33.0
12:35:16 PM: ​
12:35:16 PM: ❯ Using Next.js Runtime - v4.33.0
12:35:18 PM: ​
12:35:18 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
12:35:18 PM: ────────────────────────────────────────────────────────────────
12:35:18 PM: ​
12:35:18 PM: No Next.js cache to restore.
12:35:18 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
12:35:18 PM: ​
12:35:18 PM: (@netlify/plugin-nextjs onPreBuild completed in 14ms)
12:35:18 PM: ​
12:35:18 PM:   2. Build command from Netlify app                             
12:35:18 PM: ────────────────────────────────────────────────────────────────
12:35:18 PM: ​
12:35:18 PM: $ next build
12:35:18 PM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
12:35:18 PM: info  - Linting and checking validity of types...
12:35:19 PM: 
12:35:19 PM: Failed to compile.
12:35:19 PM: ./pages/drawing.js
12:35:19 PM: 38:71  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: ./pages/krypt.js
12:35:19 PM: 36:267  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: 38:27  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: ./components/About.js
12:35:19 PM: 33:17  Warning: Image elements must have an alt prop, either with meaningful text, or an empty string for decorative images.  jsx-a11y/alt-text
12:35:19 PM: ./components/Contacts.js
12:35:19 PM: 16:37  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: 32:105  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: ./components/Main.js
12:35:19 PM: 12:76  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: 14:51  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: ./components/Navbar.js
12:35:19 PM: 97:72  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: 124:90  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: ./components/Projects.js
12:35:19 PM: 14:51  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
12:35:19 PM: info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
12:35:19 PM: ​
12:35:19 PM:   "build.command" failed                                        
12:35:19 PM: ────────────────────────────────────────────────────────────────
12:35:19 PM: ​
12:35:19 PM:   Error message
12:35:19 PM:   Command failed with exit code 1: next build (https://ntl.fyi/exit-code-1)
12:35:19 PM: ​
12:35:19 PM:   Error location
12:35:19 PM:   In Build command from Netlify app:
12:35:19 PM:   next build
12:35:19 PM: ​
12:35:19 PM:   Resolved config
12:35:19 PM:   build:
12:35:19 PM:     command: next build
12:35:19 PM:     commandOrigin: ui
12:35:19 PM:     environment:
12:35:19 PM:       - NEXT_PRIVATE_TARGET
12:35:19 PM:     publish: /opt/build/repo/.next
12:35:19 PM:     publishOrigin: ui
12:35:19 PM:   plugins:
12:35:19 PM:     - inputs: {}
12:35:19 PM:       origin: ui
12:35:19 PM:       package: '@netlify/plugin-nextjs'
12:35:20 PM: Caching artifacts
12:35:20 PM: Started saving node modules
12:35:20 PM: Finished saving node modules
12:35:20 PM: Started saving build plugins
12:35:20 PM: Finished saving build plugins
12:35:20 PM: Started saving corepack cache
12:35:20 PM: Finished saving corepack cache
12:35:20 PM: Started saving yarn cache
12:35:21 PM: Finished saving yarn cache
12:35:21 PM: Started saving pip cache
12:35:21 PM: Finished saving pip cache
12:35:21 PM: Started saving emacs cask dependencies
12:35:21 PM: Finished saving emacs cask dependencies
12:35:21 PM: Started saving maven dependencies
12:35:21 PM: Finished saving maven dependencies
12:35:21 PM: Started saving boot dependencies
12:35:21 PM: Finished saving boot dependencies
12:35:21 PM: Started saving rust rustup cache
12:35:22 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:35:21 PM: Finished saving rust rustup cache
12:35:21 PM: Started saving go dependencies
12:35:21 PM: Finished saving go dependencies
12:35:21 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:35:22 PM: Failing build: Failed to build site
12:35:22 PM: Finished processing build request in 38.811s


![Screenshot (248)|690x343](upload://itfJhtNuuGVjtlyxOrYwuNTLF3F.png)


this is my package.json

{
β€œname”: β€œportfolio-nextjs”,
β€œversion”: β€œ0.1.0”,
β€œprivate”: true,
β€œscripts”: {
β€œdev”: β€œnext dev”,
β€œbuild”: β€œnext build”,
β€œstart”: β€œnext start”,
β€œlint”: β€œnext lint”,
β€œprod”: β€œnext export”
},
β€œdependencies”: {
β€œeslint”: β€œ8.37.0”,
β€œeslint-config-next”: β€œ13.2.4”,
β€œnext”: β€œ13.2.4”,
β€œreact”: β€œ18.2.0”,
β€œreact-dom”: β€œ18.2.0”,
β€œreact-icons”: β€œ^4.8.0”
},
β€œdevDependencies”: {
β€œautoprefixer”: β€œ^10.4.14”,
β€œpostcss”: β€œ^8.4.21”,
β€œtailwindcss”: β€œ^3.3.0”
}
}

been facing the problem for a very long time I tried vercel too but still getting the same build error. Plz help me out

You are not seeing a 127 build error @pnvish255 rather a code 1 error as seen below. This is a completely different issue.

The reasons to due to these errors

Try following the solutions provided in the error messages above.

Failing that try changing the build command to CI=false yarn build which will ignore these errors as outlined in this documentation.

Thanks for replying it worked but now getting some new errors.

1:27:43 PM: build-image version: 6c82004ef0368b3a0232c6837cead23188bb347e (focal)
1:27:43 PM: buildbot version: 0dfbdb6e6e614fd26450cfc6bacb47c4c6fd9626
1:27:43 PM: Building without cache
1:27:43 PM: Starting to prepare the repo for build
1:27:43 PM: No cached dependencies found. Cloning fresh repo
1:27:43 PM: git clone --filter=blob:none https://github.com/Shivam-vishwakarma991/Website-Portfolio
1:27:43 PM: Preparing Git Reference refs/heads/main
1:27:44 PM: Parsing package.json dependencies
1:27:45 PM: Starting to install dependencies
1:27:45 PM: Python version set to 3.8
1:27:45 PM: Using PHP version 8.0
1:27:46 PM: v16.20.0 is already installed.
1:27:46 PM: Now using node v16.20.0 (npm v8.19.4)
1:27:46 PM: Enabling Node.js Corepack
1:27:46 PM: Started restoring cached build plugins
1:27:46 PM: Finished restoring cached build plugins
1:27:46 PM: Started restoring cached corepack dependencies
1:27:46 PM: Finished restoring cached corepack dependencies
1:27:46 PM: Started restoring cached yarn cache
1:27:46 PM: Finished restoring cached yarn cache
1:27:46 PM: No yarn workspaces detected
1:27:46 PM: Started restoring cached node modules
1:27:46 PM: Finished restoring cached node modules
1:27:47 PM: Installing npm packages using Yarn version 1.22.19
1:27:47 PM: yarn install v1.22.19
1:27:47 PM: [1/4] Resolving packages...
1:27:47 PM: [2/4] Fetching packages...
1:27:57 PM: [3/4] Linking dependencies...
1:27:57 PM: warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
1:27:58 PM: [4/4] Building fresh packages...
1:27:58 PM: Done in 11.40s.
1:27:58 PM: npm packages installed using Yarn
1:27:59 PM: Attempting Ruby version 2.7.2, read from environment
1:28:00 PM: Using Ruby version 2.7.2
1:28:00 PM: Started restoring cached go cache
1:28:00 PM: Finished restoring cached go cache
1:28:00 PM: Installing Go version 1.19.5 (requested 1.19.5)
1:28:05 PM: go version go1.19.5 linux/amd64
1:28:06 PM: Install dependencies script success
1:28:06 PM: Starting build script
1:28:06 PM: Using stage install dependencies
1:28:07 PM: Detected 1 framework(s)
1:28:07 PM: "next" at version "13.2.4"
1:28:07 PM: Section completed: initializing
1:28:09 PM: ​
1:28:09 PM:   Netlify Build                                                 
1:28:09 PM: ────────────────────────────────────────────────────────────────
1:28:09 PM: ​
1:28:09 PM: ❯ Version
1:28:09 PM:   @netlify/build 29.9.0
1:28:09 PM: ​
1:28:09 PM: ❯ Flags
1:28:09 PM:   baseRelDir: true
1:28:09 PM:   buildId: 642a86f0fe1ad842d8308aa1
1:28:09 PM:   deployId: 642a86f0fe1ad842d8308aa3
1:28:09 PM: ​
1:28:09 PM: ❯ Current directory
1:28:09 PM:   /opt/build/repo
1:28:09 PM: ​
1:28:09 PM: ❯ Config file
1:28:09 PM:   No config file was defined: using default values.
1:28:09 PM: ​
1:28:09 PM: ❯ Context
1:28:09 PM:   production
1:28:09 PM: ​
1:28:09 PM: ❯ Installing plugins
1:28:09 PM:    - @netlify/plugin-nextjs@4.33.0
1:28:17 PM: ​
1:28:17 PM: ❯ Using Next.js Runtime - v4.33.0
1:28:18 PM: ​
1:28:18 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
1:28:18 PM: ────────────────────────────────────────────────────────────────
1:28:18 PM: ​
1:28:18 PM: No Next.js cache to restore.
1:28:18 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
1:28:18 PM: ​
1:28:18 PM: (@netlify/plugin-nextjs onPreBuild completed in 17ms)
1:28:18 PM: ​
1:28:18 PM:   2. Build command from Netlify app                             
1:28:18 PM: ────────────────────────────────────────────────────────────────
1:28:18 PM: ​
1:28:18 PM: $ CI=false
1:28:18 PM: ​
1:28:18 PM: (build.command completed in 7ms)
1:28:18 PM: ​
1:28:18 PM:   3. @netlify/plugin-nextjs (onBuild event)                     
1:28:18 PM: ────────────────────────────────────────────────────────────────
1:28:18 PM: ​
1:28:18 PM: ​
1:28:18 PM:   Plugin "@netlify/plugin-nextjs" failed                        
1:28:18 PM: ────────────────────────────────────────────────────────────────
1:28:18 PM: ​
1:28:18 PM:   Error message
1:28:18 PM:   Error: The directory "/opt/build/repo/.next" does not contain a Next.js production build. Perhaps the build command was not run, or you specified the wrong publish directory.
1:28:18 PM:   In most cases it should be set to ".next", unless you have chosen a custom "distDir" in your Next config.
1:28:18 PM:   If you are using "next export" then you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to "true".
1:28:18 PM: ​
1:28:18 PM:   Plugin details
1:28:18 PM:   Package:        @netlify/plugin-nextjs
1:28:18 PM:   Version:        4.33.0
1:28:18 PM:   Repository:     git+https://github.com/netlify/next-runtime.git
1:28:18 PM:   npm link:       https://www.npmjs.com/package/@netlify/plugin-nextjs
1:28:18 PM:   Report issues:  https://github.com/netlify/next-runtime/issues
1:28:18 PM: ​
1:28:18 PM:   Error location
1:28:18 PM:   In "onBuild" event in "@netlify/plugin-nextjs" from Netlify app
1:28:18 PM: ​
1:28:18 PM:   Resolved config
1:28:18 PM:   build:
1:28:18 PM:     command: CI=false
1:28:18 PM:     commandOrigin: ui
1:28:18 PM:     environment:
1:28:18 PM:       - NEXT_PRIVATE_TARGET
1:28:18 PM:     publish: /opt/build/repo/.next
1:28:18 PM:     publishOrigin: ui
1:28:18 PM:   plugins:
1:28:18 PM:     - inputs: {}
1:28:18 PM:       origin: ui
1:28:18 PM:       package: '@netlify/plugin-nextjs'
1:28:19 PM: Caching artifacts
1:28:19 PM: Started saving node modules
1:28:19 PM: Finished saving node modules
1:28:19 PM: Started saving build plugins
1:28:19 PM: Finished saving build plugins
1:28:19 PM: Started saving corepack cache
1:28:19 PM: Finished saving corepack cache
1:28:19 PM: Started saving yarn cache
1:28:20 PM: Finished saving yarn cache
1:28:20 PM: Started saving pip cache
1:28:20 PM: Finished saving pip cache
1:28:20 PM: Started saving emacs cask dependencies
1:28:20 PM: Finished saving emacs cask dependencies
1:28:20 PM: Started saving maven dependencies
1:28:20 PM: Finished saving maven dependencies
1:28:20 PM: Started saving boot dependencies
1:28:20 PM: Finished saving boot dependencies
1:28:20 PM: Started saving rust rustup cache
1:28:20 PM: Finished saving rust rustup cache
1:28:20 PM: Started saving go dependencies
1:28:20 PM: Finished saving go dependencies
1:28:21 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:28:21 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:28:21 PM: Failing build: Failed to build site
1:28:21 PM: Finished processing build request in 38.355s

You haven’t built your project. You still need to have yarn build (as my previous post shows.)

Sir I tried that but then got this error again

2:25:37 PM: build-image version: 6c82004ef0368b3a0232c6837cead23188bb347e (focal)
2:25:37 PM: buildbot version: 0dfbdb6e6e614fd26450cfc6bacb47c4c6fd9626
2:25:37 PM: Building without cache
2:25:37 PM: Starting to prepare the repo for build
2:25:37 PM: No cached dependencies found. Cloning fresh repo
2:25:37 PM: git clone --filter=blob:none https://github.com/Shivam-vishwakarma991/Website-Portfolio
2:25:37 PM: Preparing Git Reference refs/heads/main
2:25:38 PM: Parsing package.json dependencies
2:25:39 PM: Starting to install dependencies
2:25:39 PM: v16.20.0 is already installed.
2:25:40 PM: Now using node v16.20.0 (npm v8.19.4)
2:25:40 PM: Enabling Node.js Corepack
2:25:40 PM: Started restoring cached build plugins
2:25:40 PM: Finished restoring cached build plugins
2:25:40 PM: Started restoring cached corepack dependencies
2:25:40 PM: Finished restoring cached corepack dependencies
2:25:40 PM: Started restoring cached yarn cache
2:25:40 PM: Finished restoring cached yarn cache
2:25:40 PM: No yarn workspaces detected
2:25:40 PM: Started restoring cached node modules
2:25:40 PM: Finished restoring cached node modules
2:25:40 PM: Installing npm packages using Yarn version 1.22.19
2:25:41 PM: yarn install v1.22.19
2:25:41 PM: [1/4] Resolving packages...
2:25:41 PM: [2/4] Fetching packages...
2:25:52 PM: [3/4] Linking dependencies...
2:25:52 PM: warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
2:25:53 PM: [4/4] Building fresh packages...
2:25:56 PM: Done in 14.99s.
2:25:56 PM: npm packages installed using Yarn
2:25:56 PM: Python version set to 3.8
2:25:56 PM: Attempting Ruby version 2.7.2, read from environment
2:25:57 PM: Using Ruby version 2.7.2
2:25:57 PM: Started restoring cached go cache
2:25:57 PM: Finished restoring cached go cache
2:25:57 PM: Installing Go version 1.19.5 (requested 1.19.5)
2:26:02 PM: go version go1.19.5 linux/amd64
2:26:03 PM: Using PHP version 8.0
2:26:04 PM: Install dependencies script success
2:26:04 PM: Starting build script
2:26:04 PM: Using stage install dependencies
2:26:04 PM: Detected 1 framework(s)
2:26:05 PM: "next" at version "13.2.4"
2:26:05 PM: Section completed: initializing
2:26:06 PM: ​
2:26:06 PM:   Netlify Build                                                 
2:26:06 PM: ────────────────────────────────────────────────────────────────
2:26:06 PM: ​
2:26:06 PM: ❯ Version
2:26:06 PM:   @netlify/build 29.9.0
2:26:06 PM: ​
2:26:06 PM: ❯ Flags
2:26:06 PM:   baseRelDir: true
2:26:06 PM:   buildId: 642a948595a9895cbd47a223
2:26:06 PM:   deployId: 642a948595a9895cbd47a225
2:26:06 PM: ​
2:26:06 PM: ❯ Current directory
2:26:06 PM:   /opt/build/repo
2:26:06 PM: ​
2:26:06 PM: ❯ Config file
2:26:06 PM:   No config file was defined: using default values.
2:26:06 PM: ​
2:26:06 PM: ❯ Context
2:26:06 PM:   production
2:26:06 PM: ​
2:26:06 PM: ❯ Using Next.js Runtime - v4.33.0
2:26:08 PM: ​
2:26:08 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
2:26:08 PM: ────────────────────────────────────────────────────────────────
2:26:08 PM: ​
2:26:08 PM: No Next.js cache to restore.
2:26:08 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
2:26:08 PM: ​
2:26:08 PM: (@netlify/plugin-nextjs onPreBuild completed in 14ms)
2:26:08 PM: ​
2:26:08 PM:   2. Build command from Netlify app                             
2:26:08 PM: ────────────────────────────────────────────────────────────────
2:26:08 PM: ​
2:26:08 PM: $ CI=false yarn build
2:26:08 PM: yarn run v1.22.19
2:26:08 PM: $ next build
2:26:08 PM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2:26:08 PM: info  - Linting and checking validity of types...
2:26:09 PM: 
2:26:09 PM: Failed to compile.
2:26:09 PM: ./pages/drawing.js
2:26:09 PM: 38:71  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: ./pages/krypt.js
2:26:09 PM: 36:267  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: 38:27  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: ./components/About.js
2:26:09 PM: 33:17  Warning: Image elements must have an alt prop, either with meaningful text, or an empty string for decorative images.  jsx-a11y/alt-text
2:26:09 PM: ./components/Contacts.js
2:26:09 PM: 16:37  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: 32:105  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: ./components/Main.js
2:26:09 PM: 12:76  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: 14:51  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: ./components/Navbar.js
2:26:09 PM: 97:72  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: 124:90  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: ./components/Projects.js
2:26:09 PM: 14:51  Error: `'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`.  react/no-unescaped-entities
2:26:09 PM: info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
2:26:09 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
2:26:09 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2:26:09 PM: ​
2:26:09 PM:   "build.command" failed                                        
2:26:09 PM: ────────────────────────────────────────────────────────────────
2:26:09 PM: ​
2:26:09 PM:   Error message
2:26:09 PM:   Command failed with exit code 1: CI=false yarn build (https://ntl.fyi/exit-code-1)
2:26:09 PM: ​
2:26:09 PM:   Error location
2:26:09 PM:   In Build command from Netlify app:
2:26:09 PM:   CI=false yarn build
2:26:09 PM: ​
2:26:09 PM:   Resolved config
2:26:09 PM:   build:
2:26:09 PM:     command: CI=false yarn build
2:26:09 PM:     commandOrigin: ui
2:26:09 PM:     environment:
2:26:09 PM:       - NEXT_PRIVATE_TARGET
2:26:09 PM:     publish: /opt/build/repo/.next
2:26:09 PM:     publishOrigin: ui
2:26:09 PM:   plugins:
2:26:09 PM:     - inputs: {}
2:26:09 PM:       origin: ui
2:26:09 PM:       package: '@netlify/plugin-nextjs'
2:26:10 PM: Caching artifacts
2:26:10 PM: Started saving node modules
2:26:10 PM: Finished saving node modules
2:26:10 PM: Started saving build plugins
2:26:10 PM: Finished saving build plugins
2:26:10 PM: Started saving corepack cache
2:26:10 PM: Finished saving corepack cache
2:26:10 PM: Started saving yarn cache
2:26:12 PM: Finished saving yarn cache
2:26:12 PM: Started saving pip cache
2:26:12 PM: Finished saving pip cache
2:26:12 PM: Started saving emacs cask dependencies
2:26:12 PM: Finished saving emacs cask dependencies
2:26:12 PM: Started saving maven dependencies
2:26:12 PM: Finished saving maven dependencies
2:26:12 PM: Started saving boot dependencies
2:26:12 PM: Finished saving boot dependencies
2:26:12 PM: Started saving rust rustup cache
2:26:12 PM: Finished saving rust rustup cache
2:26:12 PM: Started saving go dependencies
2:26:12 PM: Finished saving go dependencies
2:26:13 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:26:13 PM: Failing build: Failed to build site
2:26:13 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
2:26:13 PM: Finished processing build request in 36.823s

A quick web search resulted in this solution on Stack Overflow

1 Like