Home
Support Forums

Build script returned non-zero exit code: 1. failed to deploy

Hi there, I need advice to debug deploy Netlify App
Already tried to change the build command, but no luck.

Hi @remyduijn

The node-gyp error is due to node-sass which is a devDependency of gulp-sass (which is one of your devDependencies.) The solution is to either upgrade your packages, or downgrade the node version used for you build as outlined here.

That said, it appears your site is already built given your repository contains mostly .html files and the package.json does not contain a build script. I suggest you remove the build command as well as the package.json and package-lock.json files. Alternatively deploy using drag and drop.

Do note that PHP is only supported at build time, so the contact.php, welcome.php and mail/contact_me.php files won’t work when deployed. If you need similar functionality, you would need to look into using Netlify functions.

1 Like

Hi @coelmay

Thank you for your reply! I have tried the things you listed above, downgraded the node version and removed the package.json and package-lock.json. Now it keeps returning an error concerning the build command (Command failed with exit code 254) and in the end it returns “Failed during stage ‘building site’: Build script returned non-zero exit code: 2”. When I remove the build command as well, like you suggested, it fails even before it starts building.

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!