Skip to content

[BUG] There is no way to force "npm init" to get the latest version of the init package #2395

@giltayar

Description

@giltayar

Current Behavior:

npm init <pkg> always runs whatever version of the <pkg> is installed and doesn't check whether
there'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:

  1. Publish @scope/create (v1.0.0)
  2. Run npm init @scope. It runs v1.0.0 as expected (which is OK).
  3. Publish a new @scope/create (v1.1.0)
  4. Run npm init @scope. It still runs v1.0.0 and there is no way to make it run v1.1.0.
  5. The workaround I have is to npm exec @scope/create@latest, which does the right thing.
  6. Even doing npm install -g @scope/create@latest doesn't help

Environment:

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

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions