The engine "node" is incompatible with this module

I am getting below yarn error when deploying to AWS

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6 <7 || >=8". Got "7.0.0"

Any idea how will this be resolved?

Will this work out if I specify engine in package.json

{ 
  "engines" : { 
    "node" : ">=8.0.0" 
  }
}

You can try to ignore the engines :

$ yarn install --ignore-engines

OR

$ yarn global add <your app> --ignore-engines

You can see all what you can ignore by running:

$ yarn help | grep -- --ignore

--ignore-scripts     don't run lifecycle scripts
--ignore-platform    ignore platform checks
--ignore-engines     ignore engines check
--ignore-optional    ignore optional dependencies

You need to upgrade your version of node.

I ran into this same issue.

If you used Homebrew run:

brew update  # This updates Homebrew to latest version
brew upgrade node

If you use nvm run:

nvm current node -v  # Checks your current version
nvm install <version>  # Example: nvm install 12.14.1

For the above step go to https://nodejs.org/en/download/

Grab a version which satisfies the conditionals in your error, the latest version should work.

More Detailed Walkthrough: https://flaviocopes.com/how-to-update-node/


A fix that is a hack can be

yarn config set ignore-engines true

However if you want a permanent solution is to :

  1. delete node_modules/, package-lock.json & yarn.lock
  2. run yarn install or npm i again.