[BUG] npx uses local package when another version is requested #3776
Labels
Bug
thing that needs fixing
Duplicate
duplicate of another, existing issue
Release 7.x
work is associated with a specific npm 7 release
Is there an existing issue for this?
Current Behavior
I have
prettier-plugin-packagejson
installed (which hassort-package-json@1.51.0
as a dependency)And trying to run
npx sort-package-json@1.48
because I want to use version 1.48, before this tragic PR was mergedBut npx picks up version 1.51.0 which is in my local deps, and in PATH. But it's the wrong version.
Expected Behavior
npx should make sure that it's running version
1.48
, as requested.Steps To Reproduce
sort-package-json
is not installed globally (npm rm sort-package-json
)which sort-package-json
should not return anythingnpm init
package.json
:npm i prettier-plugin-packagejson
npx sort-package-json@1.48
cat package.json
, see "z" will be still before "a")Optional:
rm -rf ./node_modules/
npx sort-package-json@1.48
againcat package.json
, see "a" will be before "z")Environment
The text was updated successfully, but these errors were encountered: