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