[BUG] Npm not installing expected package version
@isaacs is already working on this.
Since Jul 2, 2021.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.