Skip to content

[BUG] Npm not installing expected package version #3411

Open
@ambroiseRabier

Description

@ambroiseRabier

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When installing a new package with npm i <package_name>, if the package already exist as sub-dependencie of another package, it will install that version of the package (example 13.5.3). Instead of installing latest version (example 15.4.3). If that is a design choice, I find it counter-intuitive and hard to debug.

Expected Behavior

npm init
npm i @storybook/components
npm i react-syntax-highlighter

Should give me:

{
  "dependencies": {
    "@storybook/components": "^6.2.9",
    "react-syntax-highlighter": "^15.4.3"
  }
}

Doing npm i <package_name> when the package is absent from package.json should install the latest version by default of that package, ignoring smaller versions installed as sub-dependencie of other installed packages.

Steps To Reproduce

npm init
npm i react-syntax-highlighter
{
  "dependencies": {
    "react-syntax-highlighter": "^15.4.3"
  }
}

I have the latest version, hourra !


npm init
npm i @storybook/components
npm i react-syntax-highlighter
{
  "dependencies": {
    "@storybook/components": "^6.2.9",
    "react-syntax-highlighter": "^13.5.3"
  }
}

Why do I have 13.5.3 version ? It seem to be the same version as the one used by @storybook/components internally.

Environment

  • OS: Window 10
  • Node: v14.16.1
  • npm: 7.10.0

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingNeeds Discussionis pending a discussionPriority 2secondary priority issueRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions