Gatsby build failing due to incorrect node version detection

Hello,

I’m getting a build error trying to deploy my Gatsby site at objective-williams-e73959.netlify.app.

The logs below point to an error with my node version, but when I run node -v, I get v12.19.0. Any idea what might be going on?

10:58:05 AM: Waiting for other deploys from your team to complete
10:58:40 AM: Build ready to start
10:58:43 AM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
10:58:43 AM: build-image tag: v3.7.1
10:58:43 AM: buildbot version: 7f6e791c87eb170e7c519e73c3c0a0eca9a85dfa
10:58:43 AM: Fetching cached dependencies
10:58:43 AM: Failed to fetch cache, continuing with build
10:58:43 AM: Starting to prepare the repo for build
10:58:43 AM: No cached dependencies found. Cloning fresh repo
10:58:43 AM: git clone https://github.com/RashaMou/portfoliosite
10:58:44 AM: Preparing Git Reference refs/heads/master
10:58:46 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
10:58:46 AM: Starting build script
10:58:47 AM: Installing dependencies
10:58:47 AM: Python version set to 2.7
10:58:48 AM: Downloading and installing node v10.24.1...
10:58:48 AM: Downloading https://nodejs.org/dist/v10.24.1/node-v10.24.1-linux-x64.tar.xz...
10:58:49 AM: Computing checksum with sha256sum
10:58:49 AM: Checksums matched!
10:58:51 AM: Now using node v10.24.1 (npm v6.14.12)
10:58:51 AM: Started restoring cached build plugins
10:58:51 AM: Finished restoring cached build plugins
10:58:51 AM: Attempting ruby version 2.6.2, read from environment
10:58:53 AM: Using ruby version 2.6.2
10:58:53 AM: Using PHP version 5.6
10:58:53 AM: Started restoring cached yarn cache
10:58:53 AM: Finished restoring cached yarn cache
10:58:53 AM: Installing yarn at version 1.17.0
10:58:53 AM: Installing Yarn!
10:58:53 AM: > Downloading tarball...
10:58:53 AM: [1/2]: https://yarnpkg.com/downloads/1.17.0/yarn-v1.17.0.tar.gz --> /tmp/yarn.tar.gz.v6OfkNhnTt
10:58:53 AM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
10:58:53 AM:                                  Dload  Upload   Total   Spent    Left  Speed
10:58:54 AM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
10:58:54 AM: 100    79  100    79    0     0    338      0 --:--:-- --:--:-- --:--:--   339
10:58:54 AM: 100    93  100    93    0     0    198      0 --:--:-- --:--:-- --:--:--   198
10:58:54 AM: 100   625  100   625    0     0    800      0 --:--:-- --:--:-- --:--:--   800
10:58:55 AM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
10:58:55 AM: 100 1213k  100 1213k    0     0  1033k      0  0:00:01  0:00:01 --:--:-- 4318k
10:58:55 AM: [2/2]: https://yarnpkg.com/downloads/1.17.0/yarn-v1.17.0.tar.gz.asc --> /tmp/yarn.tar.gz.v6OfkNhnTt.asc
10:58:55 AM: 100    83  100    83    0     0   1778      0 --:--:-- --:--:-- --:--:--  1778
10:58:55 AM: 100    97  100    97    0     0   1296      0 --:--:-- --:--:-- --:--:--  1296
10:58:55 AM: 100   629  100   629    0     0   5812      0 --:--:-- --:--:-- --:--:--  5812
10:58:55 AM: 100   832  100   832    0     0   5197      0 --:--:-- --:--:-- --:--:--  5197
10:58:55 AM: > Verifying integrity...
10:58:55 AM: gpg: Signature made Fri 14 Jun 2019 06:55:58 PM UTC using RSA key ID 69475BAA
10:58:55 AM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>"
10:58:55 AM: gpg: WARNING: This key is not certified with a trusted signature!
10:58:55 AM: gpg:          There is no indication that the signature belongs to the owner.
10:58:55 AM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
10:58:55 AM:      Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
10:58:55 AM: > GPG signature looks good
10:58:55 AM: > Extracting to ~/.yarn...
10:58:55 AM: > Adding to $PATH...
10:58:56 AM: > Successfully installed Yarn 1.17.0! Please open another terminal where the `yarn` command will now be available.
10:58:56 AM: Started restoring cached node modules
10:58:56 AM: Finished restoring cached node modules
10:58:56 AM: Installing NPM modules using Yarn version 1.17.0
10:58:57 AM: yarn install v1.17.0
10:58:57 AM: [1/4] Resolving packages...
10:58:58 AM: [2/4] Fetching packages...
10:59:30 AM: error gatsby@3.2.1: The engine "node" is incompatible with this module. Expected version ">=12.13.0". Got "10.24.1"
10:59:30 AM: error Found incompatible module.
10:59:30 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
10:59:30 AM: Error during Yarn install
10:59:30 AM: Build was terminated: Build script returned non-zero exit code: 1
10:59:30 AM: Creating deploy upload records
10:59:30 AM: Failing build: Failed to build site
10:59:30 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
10:59:30 AM: Finished processing build request in 47.293974546s

Any help appreciated, thanks!

Screen Shot 2021-04-13 at 11.09.35 AM

Netlify defaults to Node 12. If the version is different, you might have done one of the following: Manage build dependencies | Netlify Docs OR you might have nodejs in your package.json.

1 Like

Thank you!

I did not have nodejs in my package.json, but adding a NODE_VERSION environment variable set to 12 fixed it.

I’m not sure why it tried to use v10 in the first place though if it defaults to 12.

1 Like

Had a similar thing, turns out my netlify.toml file defined a version of NPM which restricted my node version. Bumped this up to
[build.environment]
NPM_VERSION = “7.10.0”
fixed it

1 Like

Thanks for sharing, @realparmesan ! That is great to know :netliconfetti: