The engine "node" is incompatible with this module

238,220

Solution 1

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

Solution 2

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/

Solution 3

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.

Solution 4

Add --ignore-engines to the suffix while installing the package like this:

yarn add <package_name> --ignore-engines

Solution 5

My problem was solved with yarn --ignore-engines, but I'm not sure why and how.

Share:
238,220

Related videos on Youtube

JN_newbie
Author by

JN_newbie

A passionate software developer with a very deep interest in technologies like java/j2ee and javascript frameworks such as node.js, angularjs, angular2, jquery.

Updated on July 08, 2022

Comments

  • JN_newbie
    JN_newbie almost 2 years

    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" 
      }
    }
    
    • Shubham Sharma
      Shubham Sharma almost 5 years
      yes , you are getting this error because of incompatibility between the package version and node engine.
    • JN_newbie
      JN_newbie almost 5 years
      @ShubhamSharma, Thank you. if I specify engine block in the package.json then I will not get any error right? I am gonna try this out then
    • Shardul
      Shardul over 2 years
      Try adding .node-version or .nvmrc file to the site’s base directory in your repository.
  • J.Z.
    J.Z. about 4 years
    Optionally, if you need a specific, and not latest, version of node, you can do this: brew update; brew search node; brew unlink node; brew install node@12
  • Francisco Maria Calisto
    Francisco Maria Calisto about 3 years
    It's not a problem to provide a simple solution, but your answer should be more complete. For instance, you could provide a complete step-by-step answer to accomplish a more complete solution.
  • LukyVj
    LukyVj about 3 years
    Thanks for this :) I wouldn't recommend ignoring anything, but hey, in local it's all good :D
  • Strifey
    Strifey about 3 years
    This user is trying to manage their packages with yarn. It would probably be a good idea to stick to answering the question with the tools they're using. I'm no js expert, but I know that mixing yarn & npm can lead to strange behaviors.
  • drkvogel
    drkvogel almost 3 years
    Deleting yarn.lock and doing yarn install again worked for me, and seems the most sensible solution - I cloned a repo I hadn't touched for years, and my node version has been upgraded since - the error was because yarn.lock was telling yarn to expect a certain node version - in my case, 'Expected version ">=4 <=9". Got "16.1.0"' - so delete yarn.lock.
  • Sanan Ali
    Sanan Ali over 2 years
    You should mention "If you are not windows user" in the answer.
  • Nabil Freeman
    Nabil Freeman over 2 years
    Or, as Peter answered below, just run yarn config set ignore-engines true to disable this invasive check permanently on the whole system.
  • azizbro
    azizbro over 2 years
    @J.Z. you forgot the last step to link the installed version brew link node@12
  • glushkina1
    glushkina1 over 2 years
    still have the same error even though after updating I got "node 17.3.0 already installed" Do you know how to fix it?
  • Adam
    Adam over 2 years
    thank you! that worked.
  • Teekin
    Teekin about 2 years
    Probably old configuration files getting in the way.