Skip to content
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

[FEATURE] Make the npm update command take effect immediately #7074

Closed
2 tasks done
Beace opened this issue Dec 11, 2023 · 2 comments
Closed
2 tasks done

[FEATURE] Make the npm update command take effect immediately #7074

Beace opened this issue Dec 11, 2023 · 2 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x

Comments

@Beace
Copy link

Beace commented Dec 11, 2023

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

I understand that the npm registry has a cache of 5 minutes, and the npm CLI will always reuse the local cache until the cache expires.

This phenomenon causes the client to not make a new request to the registry when using the npm update <package> command, resulting in untimely updates.

$ npm update beace-tests --registry https://registry.npmjs.org --cache=mycache
0 verbose cli /Users/my/.nvm/versions/node/v20.9.0/bin/node /Users/my/.nvm/versions/node/v20.9.0/bin/npm
1 info using npm@10.1.0
2 info using node@v20.9.0
21 verbose title npm update beace-tests
22 verbose argv "update" "beace-tests" "--registry" "https://registry.npmjs.org" "--cache" "mycache"
38 http fetch GET 200 https://registry.npmjs.org/beace-tests 18ms (cache hit)
39 silly placeDep ROOT beace-tests@1.0.5 KEEP for: npm-test@1.0.0 want: ^1.0.5

I had to uninstall and reinstall it or choose a specific version to install.

Expected Behavior

Can we change the behavior of the npm update command to send a request verification to the registry server, even if the local cache has not expired within 5 minutes ?

Steps To Reproduce

No response

Environment

  • npm: 10.1.0
  • Node.js: v20.9.0
  • OS Name: MacOS Intel
@Beace Beace added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Dec 11, 2023
@milaninfy
Copy link
Contributor

@Beace Try adding this flag npm update --prefer-online see if that works for your use case.
https://docs.npmjs.com/cli/v10/using-npm/config#prefer-online

@milaninfy
Copy link
Contributor

This is more of a feature request. A good place to start this discussion is at https://github.com/npm/feedback

@milaninfy milaninfy closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x
Projects
None yet
Development

No branches or pull requests

2 participants