zkat / npx

execute npm package binaries (moved)
https://github.com/npm/npx
Other
2.63k stars 105 forks source link

--ignore-existing didn't work as expected #155

Open helenmasters opened 6 years ago

helenmasters commented 6 years ago

I have a global install of the generator-swiftserver package at version 4.0.0, which is therefore on my PATH on macOS, this means that npx when it runs doesn't get the latest version of the generator-swiftserver package (which is currently at 4.5.0).

From reading the npx documentation I expected that using the --ignore-existing flag would allow me to get the latest version of a package, even when I have an earlier version of said package installed globally.

The code I ran was: npx -p yo@1 -p generator-swiftserver --ignore-existing -- yo swiftserver --init This did not install the 4.5.0 version of the package.

I am using npx version 9.7.1 on macOS High Sierra

zkat commented 6 years ago

Huh, weird. I'll have to confirm this -- it might be out of npx's hands, though.

sijakret commented 6 years ago

i have the same problem trying to run a newer version of webpack regardless of what old version is installed.

something like this seems to me like the main usecase of --ignore-existing.. do you know any workaround?

zkat commented 6 years ago

@sijakret I think this issue might have more to do with yeoman being weird about its generators, because pathing.

If you just wanna use a different webpack, use the @ syntax: npx webpack@1 ..., npx webpack@2 ..., etc.

sijakret commented 6 years ago

when i execute this: npx -p webpack-dev-server@3.1.4 webpack-dev-server --version in an npm project that has webpack-dev-server 2.11.2 installed it yields this output

webpack-dev-server 2.11.2
webpack 3.11.0

that's why i tried adding the --ignore-installed flag but it does not seem to change anything npx --ignore-existing -p webpack-dev-server@3.1.4 webpack-dev-server --version gives the exact same result

is this the expected behavior?

i am runnng npx v9.7.1 - maybe this is a problem, unfortunately i am somehow too stupid to upgrade npx - can you give me a hint? npm update -g npx does not work

sijakret commented 6 years ago

upgraded to npx10.2.0, but the initial problem remains