-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] npx does not fetch latest possible semvar match #7838
Comments
I am getting expected behaviour ~/workarea/rep/test $ npx -ddd momentic@1.0.12 init
Need to install the following packages:
momentic@1.0.12
Ok to proceed? (y) y ~/workarea/rep/test $ npx momentic@^1 init
Need to install the following packages:
momentic@1.0.13
Ok to proceed? (y) |
you don't need to do that; do |
We are aware of that, but we don't want to use Besides, it seems like a bug that this behavior is a) non-deterministic across machines and b) different from what is advertised in the official docs:
|
@jeff-an what's the output of |
I put it in the environment section: version: 10.9.0 npm config: auto-install-peers = true
public-hoist-pattern = ["*eslint-plugin*","*prisma*","*bull*"] |
|
What constitutes a local project or workspace? We have not installed this package ( |
Project with package.json and dependencies installed or this cli tool installed globally. My output ~/workarea/rep $ node -v
v20.9.0
~/workarea/rep $ npm -v
10.9.0
~/workarea/rep $ npx -v
10.9.0
~/workarea/rep $ npx turbo@2.1.0 -V
Need to install the following packages:
turbo@2.1.0
Ok to proceed? (y)
ERROR unexpected argument '-V' found
tip: to pass '-V' as a value, use '-- -V'
Usage: turbo [OPTIONS] [COMMAND]
For more information, try '--help'.
~/workarea/rep $ npx turbo@^2 -V
Need to install the following packages:
turbo@2.2.3
Ok to proceed? (y)
ERROR unexpected argument '-V' found
tip: to pass '-V' as a value, use '-- -V'
Usage: turbo [OPTIONS] [COMMAND]
For more information, try '--help'.
~/workarea/rep $ npm config ls
; "project" config from /Users/milaninfy/workarea/rep/.npmrc
auto-install-peers = true
public-hoist-pattern = "[\"*eslint-plugin*\",\"*prisma*\",\"*bull*\"]"
~/workarea/rep $
|
you can use command this way |
any other information I can provide here @milaninfy ? only thing that seems to definitively fix the issue for the next invocation is |
friendly bump... |
Some possibly related weird behavior. Here |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When using the syntax
npx <package>@<semvar> <command>
,npx
is always using a local cached version instead of fetching the latest available version that falls within the semvar from the npm registry and prompting for an upgrade.Running
npm cache clean --force
does not seem to help.The issue only seems to be reproducible on some machines. One user even reported that with momentic@1.0.12 installed locally,
npx momentic^1
was still invoking1.0.11
instead of the newer version.Expected Behavior
I expect
npx
to issue a prompt like the one below:rather than proceeding with the locally cached version of momentic@1.0.12, for example.
Steps To Reproduce
npx momentic@1.0.12 init
and accept the install prompt. Ignore the output of the program (the program in this case doesn't matter and can be substituted with any other).npx momentic@^1 init
. This should be expected to prompt to install1.0.13
or whatever the latest version is. However, it does not and instead prints the same output as step 1.Screenshot of what I mean on the
turbo
repo (the latestturbo
version is2.1.3
at time of writing):Environment
I confirmed that my npx path is fixed and set to:
The text was updated successfully, but these errors were encountered: