Build command fails with: Build script returned non-zero exit code: 1

Hi

My Netlify site name is vocal-florentine-a92fb8. It fails when building. The build doesn’t fail on my laptop and runs correctly when I run “yarn build” locally. I have followed the instructions in Manage Build Dependencies and set my NODE_VERSION, NPM_VERSION and YARN_VERSION variables to match those of my computer. I’ve also tried setting my Python and Ruby versions to match my environment, to no avail.

I’ve also removed my package-lock.json file from my repo.

A requirement of the project I have is that I use Node version 13.7.0, so, unfortunately, that’s not something I can change.

Here’s my log:

2:53:27 AM: Build ready to start
2:53:59 AM: build-image version: a13ca271c42226d886b5d1dc0da3d70cb6ac0627 (focal)
2:53:59 AM: build-image tag: v4.11.0
2:53:59 AM: buildbot version: 28ac1cc020586b1ec2af1c1e9bb64025ce31310b
2:53:59 AM: Building without cache
2:53:59 AM: Starting to prepare the repo for build
2:54:00 AM: No cached dependencies found. Cloning fresh repo
2:54:00 AM: git clone git@bitbucket.org:melilocacr/melijimenez
2:54:03 AM: Preparing Git Reference refs/heads/main
2:54:06 AM: Parsing package.json dependencies
2:54:07 AM: Starting build script
2:54:07 AM: Installing dependencies
2:54:07 AM: Python version set to 2.7
2:54:08 AM: Downloading and installing node v13.7.0...
2:54:08 AM: Downloading https://nodejs.org/dist/v13.7.0/node-v13.7.0-linux-x64.tar.xz...
2:54:08 AM: Computing checksum with sha256sum
2:54:09 AM: Checksums matched!
2:54:10 AM: Now using node v13.7.0 (npm v6.13.6)
2:54:10 AM: Started restoring cached build plugins
2:54:10 AM: Finished restoring cached build plugins
2:54:10 AM: Attempting ruby version 2.7.2, read from environment
2:54:11 AM: Using ruby version 2.7.2
2:54:11 AM: Using PHP version 8.0
2:54:11 AM: Started restoring cached yarn cache
2:54:11 AM: Finished restoring cached yarn cache
2:54:12 AM: Found yarn version (1.22.10) that doesn't match expected (1.22.19)up to date in 0.017s
2:54:12 AM: Installing yarn at version 1.22.19
2:54:12 AM: Installing Yarn!
2:54:12 AM: > Downloading tarball...
2:54:12 AM: [1/2]: https://yarnpkg.com/downloads/1.22.19/yarn-v1.22.19.tar.gz --> /tmp/yarn.tar.gz.T8hJf8z7Lj
2:54:12 AM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2:54:12 AM:                                  Dload  Upload   Total   Spent    Left  Speed
2:54:12 AM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2:54:12 AM: 100    81  100    81    0     0    710      0 --:--:-- --:--:-- --:--:--   710
2:54:12 AM: 100    95  100    95    0     0    508      0 --:--:-- --:--:-- --:--:--   508
2:54:12 AM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2:54:12 AM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2:54:13 AM: 100 1215k  100 1215k    0     0  2542k      0 --:--:-- --:--:-- --:--:-- 2542k
2:54:13 AM: [2/2]: https://yarnpkg.com/downloads/1.22.19/yarn-v1.22.19.tar.gz.asc --> /tmp/yarn.tar.gz.T8hJf8z7Lj.asc
2:54:13 AM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2:54:13 AM:                                  Dload  Upload   Total   Spent    Left  Speed
2:54:13 AM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2:54:13 AM: 100    85  100    85    0     0   1231      0 --:--:-- --:--:-- --:--:--  1231
2:54:13 AM: 100    99  100    99    0     0   1207      0 --:--:-- --:--:-- --:--:--  1207
2:54:13 AM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2:54:13 AM: 100   833  100   833    0     0   4271      0 --:--:-- --:--:-- --:--:--  4271
2:54:13 AM: > Verifying integrity...
2:54:13 AM: gpg: Signature made Tue 10 May 2022 07:48:23 PM UTC
2:54:13 AM: gpg:                using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
2:54:13 AM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>" [unknown]
2:54:13 AM: gpg: WARNING: This key is not certified with a trusted signature!
2:54:13 AM: gpg:          There is no indication that the signature belongs to the owner.
2:54:13 AM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
2:54:13 AM:      Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
2:54:13 AM: > GPG signature looks good
2:54:13 AM: > Extracting to ~/.yarn...
2:54:13 AM: > Adding to $PATH...
2:54:13 AM: > Successfully installed Yarn 1.22.19! Please open another terminal where the `yarn` command will now be available.
2:54:13 AM: No yarn workspaces detected
2:54:13 AM: Started restoring cached node modules
2:54:13 AM: Finished restoring cached node modules
2:54:14 AM: Installing NPM modules using Yarn version 1.22.19
2:54:14 AM: yarn install v1.22.19
2:54:14 AM: warning package.json: No license field
2:54:14 AM: warning sely-reactjs@1.0.0: No license field
2:54:14 AM: [1/4] Resolving packages...
2:54:15 AM: [2/4] Fetching packages...
2:54:31 AM: error pretty-format@27.5.1: The engine "node" is incompatible with this module. Expected version "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0". Got "13.7.0"
2:54:31 AM: error Found incompatible module.
2:54:31 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2:54:31 AM: Creating deploy upload records
2:54:31 AM: Error during Yarn install
2:54:31 AM: Build was terminated: Build script returned non-zero exit code: 1
2:54:31 AM: Failing build: Failed to build site
2:54:31 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
2:54:31 AM: Finished processing build request in 31.902927224s

Hi @melilocacr

As per the logs, you are using NodeJS 13

however, pretty-format is requiring one of the following versions of NodeJS (of which v13 is not listed)

So, you need to change the NodeJS version used to build your site. This is done using the NODE_VERSION environment variable.

As you can see in my inquiry, I said that I have to use Node 13 with this build. It’s a requirement for the theme that I’m using. Any other node versions will break the site. The site is building correctly on my local instance, using Node 13, including the package that’s having an issue. I’m not sure why it’s not working with the live instance or where the discrepancy is coming from. In other words, if pretty-format requires another Node version, why isn’t it prompting me to change it in my local environment?

El El dom, oct. 2, 2022 a la(s) 3:23 a.m., Coel May via Netlify Support Forums <notifications@netlify.discoursemail.com> escribió:

Hi @melilocacr,

Unfortunately, I can only second what @coelmay said. The error says that Node 13 is not supported by that dependency. Maybe some other version of it supports it? Maybe the linux version of that dependency doesn’t run on Node 13? In any case, what Coel has already said is the exact issue. You need to use a different Node Version and try to make your project compatible to that. I believe, Node 13 has reached its End of Life anyways.

Node 13 support was dropped from Jest (including pretty-format) almost two years ago

I can only think the version used locally doesn’t match that installed above: pretty-format@27.5.1 which itself isn’t current as it was released in february.

If you really want to use the exact setup you have and not upgrade packages etc to use a current of LTS version of NodeJS as Hrishikesh suggested have you tried using exact dependency versions in the package.json to ensure those versions are used?

Thanks for your answer. So I’m a little confused as to how I do this.

From my understanding, pretty-format 27.5.1 requires a different version of Node. So you suggest that I specify an earlier version of pretty-format that does support Node 13. Correct?

I went to package.json and added pretty-format: "27.5.0" under dependencies, which is the earlier version of pretty-format. But I think pretty-format is actually being installed by another package. So even when I specify a version, the build is still trying to install 27.5.1

How would I tell my build to use the earlier version of pretty-format?

Sorry, I’m still a little lost on how this all works. Thanks for your patience

The last version to support NodeJS 13 was 26.6.1 as the pull request I linked bumped the version to 26.6.2.

Did you edit the package.json manually or run npm install pretty-format@26.6.1? If the former, then the v27 dependency is still in the package-lock.json or yarn.lock.

This is quite possible too.

If everything is working locally, you could build locally and deploy with Netlify CLI.

If you want to do the build on Netlify you would need to sort out the dependencies so they are all compatible with NodeJS v13, or update everything to work on (ideally) on v16 (though v14 above v14.16.0 is still supported.)

1 Like