You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] npx won't using latest version of package if already run #6179
This is a re-opening of an old issue with npm@7 - documented here: #4108
The final comment in that issue seems to indicate the bug was fixed, but it is currently occurring in npm@9 (so it was either verified incorrectly or has regressed).
Current behaviour is as follows:
# Assume latest version of package-name is 1.0.0
npx package-name # will download & run 1.0.0# Assume 1.0.1 is released
npx package-name # will run 1.0.0 - fails to update
npx package-name@1.0.1 # will run 1.0.1 - downloads new version
npx package-name # will STILL run 1.0.0 - newly downloaded 1.0.1 seems to have been cached in a separate location?
Expected Behavior
There should be some sane way to get npx to run the latest version of a package without having to specify @version every time.
My consumers are experiencing the same thing. I've been recommending a one-line usage to my package consumers like this:
npx --yes -- @me/my-package blah blah
and occasionally get complaints that "my package documentation is wrong" when, in fact, npx has simply stopped updating its cache at some point (the precise npx version at which the behavior changed is unknown) and so some users are unwittingly stuck on older versions of my package.
I've been recommending on a case-by-case basis that they start appending @latest to my package name or else formally install it as a dev dependency, but they don't like it when I tell them to change their workflows.
Activity
dabrady commentedon Apr 12, 2023
My consumers are experiencing the same thing. I've been recommending a one-line usage to my package consumers like this:
and occasionally get complaints that "my package documentation is wrong" when, in fact,
npxhas simply stopped updating its cache at some point (the precisenpxversion at which the behavior changed is unknown) and so some users are unwittingly stuck on older versions of my package.I've been recommending on a case-by-case basis that they start appending
@latestto my package name or else formally install it as a dev dependency, but they don't like it when I tell them to change their workflows.dabrady commentedon Apr 20, 2023
Amazing, thank you @wraithgar 🙇🏻