[BUG] `npm update` deletes name property of @scoped workspace dependencies from the package-lock
Nobody has claimed this yet.
- 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
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
When using workspaces some of the workspace names may be scoped. When this is the case the package-lock includes the "name" property of the scoped, locally resolved packages. Running npm update removes the name properties, causing resolution issues later during release, after running npm install after an npm version.
Expected Behavior
The command npm update preserves the name property in the package-lock.json when present.
Steps To Reproduce
- Using npm@8.5.3 with Node 16
- Run:
git clone https://github.com/riovir/npm-update-deleted-name-reprod.git
cd npm-update-deleted-name-reprod
npm ci
npm update
git diff
- Notice how the
nameprops are missing. - Note that running
npm installputs them back.
Environment
- npm: 8.5.3
- Node.js: 16.14.0
- OS Name: Windows 10 Pro
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.
Research direction
Clone riovir/npm-update-deleted-name-reprod and run the listed npm ci, npm update, and git diff steps to reproduce the package-lock.json change. Trace the npm update handling for scoped workspace dependencies and verify that the name properties remain after updating, while npm install continues to restore them when needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100