Skip to content
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] incomplete lock file is generated for workspaces on first install #2700

Closed
targos opened this issue Feb 14, 2021 · 5 comments
Closed
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@targos
Copy link
Contributor

targos commented Feb 14, 2021

Current Behavior:

After installing the dependencies in an npm workspace for the first time, running npm install a second time changes the package-lock.json: a "name" field is added to the sub-packages metadata.

Expected Behavior:

Running npm install right after creation of the package-lock.json shouldn't change it.

Steps To Reproduce:

You can reproduce with the following repo: the last commit contains the package-lock.json created by the first npm install call.

git clone https://github.com/targos/npm-workspace-lock.git
cd npm-workspace-lock
npm install
git diff
diff --git a/package-lock.json b/package-lock.json
index 4ab3edc..57665a3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21611,12 +21611,14 @@
       }
     },
     "one": {
+      "name": "npm-workspace-lock-one",
       "version": "1.0.0",
       "dependencies": {
         "got": "^11.8.1"
       }
     },
     "two": {
+      "name": "npm-workspace-lock-two",
       "version": "1.0.0",
       "devDependencies": {
         "react-scripts": "^4.0.1"

Environment:

  • OS: Windows 10, macOS
  • Node: 15.8.0
  • npm: 7.5.4
@targos targos added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Feb 14, 2021
@darcyclarke darcyclarke added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels Feb 19, 2021
@targos
Copy link
Contributor Author

targos commented Mar 23, 2021

FWIW I can still reproduce with v7.6.3

@darcyclarke
Copy link
Contributor

@targos can you try replicating on latest again? (ie. npm i -g npm) latest should be v7.16.0 at the moment.

@darcyclarke darcyclarke added Priority 2 secondary priority issue and removed Priority 1 high priority issue labels Jun 9, 2021
@targos
Copy link
Contributor Author

targos commented Jun 12, 2021

Seems fixed!

@targos targos closed this as completed Jun 12, 2021
@JanMisker
Copy link

I still have the same problem, I'm on npm 7.20.2

@danielpza
Copy link

I have the same problem on npm 8.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

4 participants