-
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] There is no way to force "npm init" to get the latest version of the init package #2395
Comments
After a day of investigation this turns out to be a bug in (make-fetch-happen)[https://github.com/npm/make-fetch-happen] where it is not obeying what starts as |
It turns out what I thought was a fetch bug is a logging quirk. If the registry itself sends a 304, the response the cli gets still looks like a cache hit, and logs in the output as The good news for you is that if you use |
@wraithgar I tried (BTW, using |
Glad you have a workaround. Re-opened the issue so we can take a closer look. |
I think we should make sure that |
v7 should once again match v6 behavior in the next release (v7.5.2). Changing it further should probably involve an RFC discussion. |
I'm on npm v8.5.1 and this seems to be back? e.g. now I finally get why many docs pages are using |
I can confirm this bug in npm@8.19.1 |
This is related caching behavior of "npm init", more discussion see npm/cli#2395
The bug is still there. Although the document says:
When I run Both results should be the same. |
My workaround is to delete the npx cache inside .npm |
so I have tended to always include an
|
Current Behavior:
npm init <pkg>
always runs whatever version of the<pkg>
is installed and doesn't check whetherthere's a later version. Moreover, there is no way to tell it to do that.
Expected Behavior:
npm init <pkg>
should first check if there's an updated version of<pkg>
and install that before running it.Alternatively, there should be an option (
--update
?) that updates to the latest version before running it.Steps To Reproduce:
@scope/create
(v1.0.0)npm init @scope
. It runs v1.0.0 as expected (which is OK).@scope/create
(v1.1.0)npm init @scope
. It still runs v1.0.0 and there is no way to make it run v1.1.0.npm exec @scope/create@latest
, which does the right thing.npm install -g @scope/create@latest
doesn't helpEnvironment:
I'm guessing all versions, but specifically what I'm running on is:
OS: MacOS Big Sur
Node.js: 15.3.0.
NPM: 7.0.14
The text was updated successfully, but these errors were encountered: