What is the cause of "npm WARN EBADENGINE"?

When generating a package-lock.json file using npm install, I get this error:

npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '[email protected]', npm WARN EBADENGINE required: { node: '16.0.0' }, npm WARN EBADENGINE current: { node: 'v16.10.0', npm: '7.24.0' } npm WARN EBADENGINE } 

I'm a little confused here. It requires Node v16.0.0, and that's the one I'm using. Isn't npm v7.x.x compatible with that version of node?

2

5 Answers

You are using 16.10.0, but the message says it requires 16.0.0. Not 16.0.0 or greater. It requires exactly 16.0.0.

If it's your package.json with the engines field causing this issue, change it to say 16.0.0 or greater:

 "engines": { "node": ">=16.0.0" }, 
3

If you are using nvm run

nvm install 18.1.0 nvm use 18.1.0 

If you don't have nvm installed follow this tutorial

4

This problem took so much of my time, what I did finally was I downloaded the required version of node from here >>>

After downloading and installing the new node, just rerun npm install inside the directory of your project. It sorted my problem,

1

at package.lock.json, do this:

 "engines": { "node": ">=0.7.0 <16.15.0" } 

This will almost support all nodejs npm modules.

see this line

npm WARN EBADENGINE required: { node: '>= 0.8.0 < 0.11.0' }, 

this meant node engine should have range anywhere between 0.8.0 and 0.11.0, e.g. engines": {"node": ">=0.7.0 <16.15.0"} or engines": {"node": ">=0.9.0 <11.15.0"} etc.

3

I ended up editing the 'engines' entry in package.json for the project to precisely match what was installed on my machine (the versions of both my node and npm matched the requirements in spite of the error telling me otherwise).

Before (in package.json):

"engines": { "node": "^18.14.1", "npm": "^9.5.0" }, 

Which threw the following error on npm install:

... npm ERR! notsup Required: {"node":"^18.14.1","npm":"^9.5.0"} npm ERR! notsup Actual: {"npm":"9.6.1","node":"v19.7.0"} npm ERR! A complete log of this run can be found in: ... 

After:

"engines": { "npm": "9.6.1", "node" : "v19.7.0" }, 

Nb. I included the 'v' in the version number as per a comment on the original question (although I didn't confirm whether that was the issue or not).

1

You Might Also Like