Skip to content

[BUG] npx does not respect version range if a compatible version is found inside any package installed globally #7486

@mshima

Description

@mshima

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

Installed package is used even if the version range does not match.

npm install -g generator-jhipster@8.3.0 generator-jhipster-native@2.1.0
npx generator-jhipster@8.4.0 --version
8.3.0

Expected Behavior

The version range should be respected.

npm install -g generator-jhipster@8.3.0
npx generator-jhipster@8.4.0 --version
8.4.0

Steps To Reproduce

No response

Environment

  • npm: 10.7.0
  • Node.js: v18.20.2
  • OS Name: MacOS
  • System Model Name: MacBook Air
  • npm config:
; "builtin" config from /opt/homebrew/lib/node_modules/npm/npmrc

prefix = "/opt/homebrew"

; "user" config from /Users/mshima/.npmrc

//registry.npmjs.org/:_authToken = (protected)

; node bin location = /usr/local/bin/node
; node version = v18.20.2
; npm local prefix = /Users/mshima/git/test
; npm version = 10.7.0
; cwd = /Users/mshima/git/test
; HOME = /Users/mshima
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 2secondary priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions