cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Option engine-strict=true is not compatible with --omit=dev

Open sempasha opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

This issue exists in the latest npm version

  • [X] I am using the latest npm

Current Behavior

Running npm install --omit=dev with config option engine-strict=true leads to compatibility errors even for dependencies of any kind.

Expected Behavior

While running npm install --omit=dev with config option engine-strict=true npm ignores compatibility errors for dev only dependencies.

Steps To Reproduce

Let's say you have package with package.json manifest

{
  "name": "uncompatible-package",
  "version": "1.0.0",
  "engines": {
    "node": ">=100500"
  }
}

And you have application package, where you want to have uncompatible-package as dev dependency

{
  "name": "application",
  "version": "1.0.0",
  "devDependencies": {
    "uncompatible-package": "./uncompatible-package-1.0.0.tgz"
  }
}

And you set engine-strict=true option for your application package

$ npm config set engine-strict true

And when you want to install only production dependencies you have compatibility error

$ npm install --omit=dev
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Required: {"node":">=100500"}
npm ERR! notsup Actual:   {"npm":"10.1.0","node":"v20.6.1"}

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sempasha/.npm/_logs/2023-09-14T15_31_44_507Z-debug-0.log

Environment

  • npm: 10.1.0
  • Node.js: 20.6.1
  • OS Name: Fedora Linux
  • System Model Name: PC
  • npm config:
engine-strict = true

sempasha avatar Sep 14 '23 15:09 sempasha