Netlify deployment fails with message: failed during stage 'building site': Build script returned non-zero exit code: 127

My site keeps failling to build, and I have no idea why. I’ve searched MANY posts and have tried a lot of different fixes. None of them work.


hi, welcome! that is frustating
can you post your deploy log please, or link to it?

also worth telling us which posts you have read so we don’t suggest them again. :wink:

Hi guys,

I’m using Angular for my app and struggling to deploy.

I’ve tried removing the package.lock file and also re-installed node module but still not getting it right.

I’m getting the following error:

hey there, sorry to hear you are having trouble.

So the issue is most likely this one:

Executing user command: ng build --prod

it’ll error like this if the angular package isn’t installed correctly or this command isn’t listed in your package.json or there is a mismatch between that and your build settings. Your app literally doesn’t know what ng is for some reason.

If I were you i’d start troubleshooting here.

also more info here:

if you can’t fix it, please post a screenshot of your build settings and also show us your package.json please.

Hi Perry,

Thanks for the feedback.

I’ve update my package.json file to include “ng build --prod” but still not working.

See screenshot below.

Build setting file

hmm, maybe i am misunderstanding, but i think, judging by your package.json that the build command should simply be build, no? as that would resolve to the full command of ng build--prod.

could you try that in your build settings and see if it works?

I’ve managed to get it right.

Had to add path: “Portfolio/dist/Portfolio” to my “Publish directory” build settings".

Thanks a lot for assisting.

Hi, @mbowenitj, thank you for sharing your solution here on the community site. This should be helpful to others in the future with similar questions. :slight_smile: