-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm install
does not detect engine-compatible package properly
#6743
Comments
npm install
does not detect engine-compatible package properly
I have exact the same issue though the version of nodejs is defferent. Here is my environment.
|
update: tested with npm from v6 to v10 -- latest each |
I created a local testing package with different versions supporting different engines ~/workarea/rep $ npm view pkgengine@"1||2||3||4||5||6" engines
[email protected] { node: '^18.0.0' }
[email protected] { node: '^19.0.0' }
[email protected] { node: '^20.0.0' }
[email protected] { node: '^21.0.0' }
[email protected] { node: '^22.0.0' }
[email protected] { node: '^23.0.0' } it succeeds when it finds appropriate version satisfying the range and engine requirements and throws error otherwise. ~/workarea/rep $ node -v
v18.20.4
~/workarea/rep $ npm -v
10.8.3
~/workarea/rep $ npm i --engine-strict pkgengine@"^1||^2||^3||^4||^5"
added 1 package, and audited 2 packages in 565ms
found 0 vulnerabilities
~/workarea/rep $ npm ls
[email protected] /Users/milaninfy/workarea/rep
└── [email protected]
~/workarea/rep $ npm i --engine-strict pkgengine@"^2||^3||^4||^5"
npm error code EBADENGINE
npm error engine Unsupported engine
npm error engine Not compatible with your version of node/npm: [email protected]
npm error notsup Not compatible with your version of node/npm: [email protected]
npm error notsup Required: {"node":"^22.0.0"}
npm error notsup Actual: {"npm":"10.8.3","node":"v18.20.4"}
npm error A complete log of this run can be found in: /Users/milaninfy/.npm/_logs/2025-01-06T19_49_38_042Z-debug-0.log appears to be fixed on |
re: #6743 (comment) thanks for the research. i will also check and see if i can reproduce the findings/results. |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
given: a package
my-package
exists in multiple versions1.0
support node>=v14
1.1
support node>=v14
2.0
support node>=v16
2.1
support node>=v16
installing
my-package@^1||^2
in a multi-version-range manner with optionengine-strict
enabled:2.1
is not supported by the current engine2.1
with no problemsExpected Behavior
npm installer detects the highest engine-compatible version and installed it.
installing
my-package@^1||^2
in a multi-version-range manner with optionengine-strict
enabled:1.1
with no problems2.1
with no problemsSteps To Reproduce
Prerequisite:
normalize-package-data@^3
supports node14 as ofhttps://github.com/npm/normalize-package-data/blob/4121d78eb9d17a2ff738582de48429f8a84dd2c4/package.json#L38-L40
npm init -y
npm i --engine-strict 'normalize-package-data@^3||^4||^5||^6'
Environment
9.8.1
-- tested also withnpm@[6,7,8,9,10].x
latest version each.v14.21.3
Linux 5206377178b3 6.2.0-27-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 12 22:39:51 UTC 2023 x86_64 GNU/Linux
node:14
The text was updated successfully, but these errors were encountered: