3

I am having issues deploying recent changes made from a Gatsby project to Netlify. Start and build commands for the project locally works fine.

Here is the problem:

error gatsby@3.6.0: The engine "node" is incompatible with this module. Expected version ">=12.13.0". Got "10.24.1"

Here are links to the repo and deployment log:

https://github.com/simonxcode/simonxcode.com https://app.netlify.com/sites/simonxcode/deploys/60aeec1c22d2e5154232e488

I know this question has been asked numerous times before, but none of the common solutions worked for me. Perhaps I am executing them incorrectly or may be missing something else.

Here are the solutions that I have tried:

  1. execute yarn --ignore-engines from How to ignore incompatible engine "node" error on installing npm dependencies with yarn?

  2. set node variable in .env file (not visible in repo because .gitignore) from Setting Environment Variables for Node to retrieve

     //.env file
     NODE_ENV=development
    
  3. add "engine": { "node": ">=12.13.0"} to package.json from The engine "node" is incompatible with this module

  4. Update node with brew update and brew upgrade node from The engine "node" is incompatible with this module

    • Note 1: Before updating Homebrew, I deleted node_modules/ and yarn.lock files

    • Note 2: after executing brew postinstall node and brew link --overwrite node, I no longer have access to node, yarn or gatsby when checking with node -v, yarn -v and gatsby -v

simonxcode
  • 143
  • 1
  • 3
  • 13
  • 1
    You just need to update node, which isn’t difficult to do. There are various ways to do this. Sounds like you’re having issues with this, I’d change the question to be about your issues with updating node and provide more detail. – JBallin May 29 '21 at 00:48
  • Initially was a long time ago. Haha. I believe it was with npm, then I updated with yarn and homebrew. – simonxcode May 29 '21 at 00:54
  • 1
    I would research how to fully uninstall node from your machine and then simply run “brew install node yarn”. You can later set up nvm on top of this if you need to change versions. – JBallin May 29 '21 at 00:56
  • Yeah, at this stage it may be best to start with a clean slate. Will go ahead and do that. Thanks! – simonxcode May 29 '21 at 00:58

4 Answers4

2

I was able to resolve this issue by declaring Node version in Netlify's deployment setting. Build and Deploy environment variables were:

key: NODE_VERSION value: 12.13.0

Screenshot of Environment Variable

Here is more information regarding how to manage dependecies on Netlify.

https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript

Lastly, I ran into some other issues with current version of node(16.2.0), so will stick with 12.13.0 for now. ;)

simonxcode
  • 143
  • 1
  • 3
  • 13
2

As of 21 November 2021, if Expected version ">=14.15.0". Got "12.13.0". Simply update your Netlify environment variables with:

Key: NODE_VERSION Value: 14.15.0

It works fine for me.

cyeehan
  • 21
  • 2
1

I've run into a similar issue using an outdated NodeJs version.

Check: npm get to see if you have strict engine checking set to true.

If so, and if you are not in a position to simply upgrade node: npm set engine-strict false

This fixed my issue while working on an upgraded version of the project.

robert arles
  • 153
  • 2
  • 9
0

I took care of this by using nvm. Nvm is the node version manager. I simply ran nvm install 12.13.0 and everything then worked fine.

james-see
  • 12,210
  • 6
  • 40
  • 47