Error running command: Build script returned non-zero exit code: 127

It seems the build is failing when I try to deploy my site to netlify, judging from the logs it could be my parcel.js setup. The error in the logs are:

12:19:29 AM: Error running command: Build script returned non-zero exit code: 127
12:19:29 AM: Failing build: Failed to build site
12:19:29 AM: failed during stage 'building site': Build script returned non-zero exit code: 127
12:19:29 AM: Finished processing build request in 21.32707912s

My deploy setting on Netlify are:

Base directory: Not set
Build command: parcel build index.html
Publish directory: dist

Having searched for similar problems I thought it could be dependency issue, however, after using ‘Yarn’ to install dependencies I still get the same problem.

package.json

{
  "name": "ed",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "fullpage.js": "^3.0.5"
  },
  "devDependencies": {
    "cssnano": "^4.1.10"
  }
}

Below is the file structure, any help in troubleshooting this would be greatly appreciated.

enter image description here

I’d suggest using the workflow described here to debug:

…and if you can’t get things working, letting us know 2 things that will help us advise you:

  1. what you’ve tried to fix it and
  2. link to the logs in our UI so we can examine in more detail

The reason I don’t have more specific advice right now is that you’ve shown only the symptoms of the failure - and not the failure itself, which would be further up the logs or instead not discoverable even by us from the logs without knowing the deploy ID.

I was stuck with this same error yesterday. It seems that Netlify did not like seeing both package-lock.json and yarn.lock files. I’ve been using npm as my package manager, so I deleted yarn.lock and my builds started to work again.

I would also suggest deleting node_modules, package-lock.json, and doing a fresh npm install, just to be thorough.

3 Likes

these are super helpful suggestions, @stufinn!

1 Like

Thanks! Removing the yarn.lock file also worked for me.

2 Likes

Just thought I’d chime in with my resolution for this error. The netlify.toml file command had “yarn run build” for the [build] command. Since I am using npm that’s obviously a problem. Replaced with “npm run build” and all is well.

1 Like

thanks for sharing your solution, @robinleboe! I bet you are not the only one!

1 Like