Skip to content
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

Open
2 tasks done
jkowalleck opened this issue Aug 28, 2023 · 2 comments
Open
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@jkowalleck
Copy link

jkowalleck commented Aug 28, 2023

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

given: a package my-package exists in multiple versions

  • version 1.0 support node >=v14
  • version 1.1 support node >=v14
  • version 2.0 support node >=v16
  • version 2.1 support node >=v16

installing my-package@^1||^2 in a multi-version-range manner with option engine-strict enabled:

  • done on a node14 env: does not install anything, errors that version 2.1 is not supported by the current engine
  • done on a node16 env: installs version 2.1 with no problems

Expected Behavior

npm installer detects the highest engine-compatible version and installed it.

installing my-package@^1||^2 in a multi-version-range manner with option engine-strict enabled:

  • done on a node14 env: installs version 1.1 with no problems
  • done on a node16 env: installs version 2.1 with no problems

Steps To Reproduce

Prerequisite: normalize-package-data@^3 supports node14 as of
https://github.com/npm/normalize-package-data/blob/4121d78eb9d17a2ff738582de48429f8a84dd2c4/package.json#L38-L40

  1. In a fresh node14 environment
  2. Run npm init -y
  3. RUN npm i --engine-strict 'normalize-package-data@^3||^4||^5||^6'
  4. See error
     npm ERR! code EBADENGINE
     npm ERR! engine Unsupported engine
     npm ERR! engine Not compatible with your version of node/npm: normalize-package-data@6.0.0
     npm ERR! notsup Not compatible with your version of node/npm: normalize-package-data@6.0.0
     npm ERR! notsup Required: {"node":"^16.14.0 || >=18.0.0"}
     npm ERR! notsup Actual:   {"npm":"9.8.1","node":"v14.21.3"}
     
     npm ERR! A complete log of this run can be found in: .../.npm/_logs/2023-08-28T08_34_08_802Z-debug-0.log
    

Environment

  • npm: 9.8.1 -- tested also with npm@[6,7,8,9,10].x latest version each.
  • Node.js: v14.21.3
  • OS Name: Linux 5206377178b3 6.2.0-27-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 12 22:39:51 UTC 2023 x86_64 GNU/Linux
  • System Model Name: docker node:14
  • npm config:
; node bin location = /usr/local/bin/node
; node version = v14.21.3
; npm local prefix = /tmp/dsdsadsd
; npm version = 9.8.1
; cwd = /tmp/dsdsadsd
; HOME = /...
; Run `npm config ls -l` to show all defaults.
@jkowalleck jkowalleck added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Aug 28, 2023
@jkowalleck jkowalleck changed the title [BUG] <title> [BUG] npm install does not detect engine-compatble package properly Aug 28, 2023
@jkowalleck jkowalleck changed the title [BUG] npm install does not detect engine-compatble package properly [BUG] npm install does not detect engine-compatible package properly Aug 28, 2023
@golf-junkie
Copy link

I have exact the same issue though the version of nodejs is defferent.

Here is my environment.

  • npm: 9.8.1
  • Node.js: 16.20.2
  • OS Name: 4.14.320-242.534.amzn2.x86_64 #1 SMP Wed Jul 12 19:43:51 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@jkowalleck
Copy link
Author

update: tested with npm from v6 to v10 -- latest each
all have this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

No branches or pull requests

2 participants