Search code examples
npmnpm-installpackage.json

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?


Solution

  • 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"
      },
    

    That will allow Node.js 16.x and greater.

    If you want to restrict it to 16.x but not permit 17.x and greater, you can use this:

      "engines": {
        "node": "^16.0.0"
      },