Deploy failed : 'building site': Build script returned non-zero exit code: 1

I got this error when I push & auto-deploy. (it worked fine 1 month before)
It seems I have some depreciated dependencies and missing files, but I could not find the reason.

※I tried to remove package.json and run npm install to recreate package.json on local ENV, but I still get the same error.

‘Build Settings’
Command : hugo --theme=hugo-tranquilpeak-theme --buildDrafts

Build Log

Failed during stage ‘building site’: Build script returned non-zero exit code: 1

ENOENT: no such file or directory, open ‘./package-lock.json’

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})

hey there, we do need a package.json in with your github repo in most cases. We don’t explicitly require the package-lock file, but it is a good idea to commit it as it contains information about packages that are installed locally, it helps make sure we keep things in sync and in a working configuration.

It’s fine to delete it (the package.json file) from the repo and recreate locally, but you do want to add it back in and push it to wherever you are storing your repo so that we can parse it and download the correct dependencies for your project. Can you add it back in and see if the error goes away?

1 Like

Hi Perry!
I could fix this issue by recreating package.json + package-lock.json, plus removing unused dependency + unused netlify.toml contents.

I guess some unused old libraries have got conflicted while a few months passed.
I appreciate for your advise, thank you so much!

1 Like