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] npm version with workspace will not write new data back to package-lock.json #4193

Closed
2 tasks done
zthxxx opened this issue Dec 27, 2021 · 6 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@zthxxx
Copy link

zthxxx commented Dec 27, 2021

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

  1. run npm version for workspaces with -w <workspace> args
  2. see only changed package.json but not change lockfile

Expected Behavior

run npm version -w <workspace> need adjust new version of workspace package in package-lock.json

As it said in npm cli docs:

Run this(npm version) in a package directory to bump the version and write the new data back to package.json, package-lock.json, and, if present, npm-shrinkwrap.json.

image

Steps To Reproduce

  1. run npm version for workspaces with -w <workspace> args
  2. see only changed package.json but not change lockfile
  3. for verify whether lockfile need update, I have run npm install
  4. yes, lockfile changed

image

image

Environment

  • npm: 8.3.0
  • Node: 16.8.0
  • OS: macOS 11.15
  • platform: Mac
  • npm config:
audit = false
fund = false
if-present = true
ignore-scripts = false
yes = true
@zthxxx zthxxx added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Dec 27, 2021
@wraithgar
Copy link
Member

Closing as a duplicate of #3403

@zthxxx
Copy link
Author

zthxxx commented Mar 16, 2022

My solution: move to using pnpm

ruyadorno added a commit to ruyadorno/cli that referenced this issue Mar 17, 2022
Adds a minimalistic reify step that updates the installed tree after a
version change within one of the configured workspaces when using any
of the workspaces config options.

It's also possible to use the `--save` config option in order to
auto update semver ranges of dependencies declarations accross dependent
`package.json` files.

Fixes: npm#3403
Relates to: npm/rfcs#556
Relates to: npm#3757
Relates to: npm#4193
ruyadorno added a commit to ruyadorno/cli that referenced this issue Mar 17, 2022
Adds a minimalistic reify step that updates the installed tree after a
version change within one of the configured workspaces when using any
of the workspaces config options.

It's also possible to use the `--save` config option in order to
auto update semver ranges of dependencies declarations accross dependent
`package.json` files.

Fixes: npm#3403
Relates to: npm/rfcs#556
Relates to: npm#3757
Relates to: npm#4193
ruyadorno added a commit to ruyadorno/cli that referenced this issue Mar 21, 2022
Adds a minimalistic reify step that updates the installed tree after a
version change within one of the configured workspaces when using any
of the workspaces config options.

It's also possible to use the `--save` config option in order to
auto update semver ranges of dependencies declarations accross dependent
`package.json` files.

Fixes: npm#3403
Relates to: npm/rfcs#556
Relates to: npm#3757
Relates to: npm#4193
fritzy pushed a commit that referenced this issue Mar 24, 2022
Adds a minimalistic reify step that updates the installed tree after a
version change within one of the configured workspaces when using any
of the workspaces config options.

It's also possible to use the `--save` config option in order to
auto update semver ranges of dependencies declarations accross dependent
`package.json` files.

Fixes: #3403
Relates to: npm/rfcs#556
Relates to: #3757
Relates to: #4193
@jonthomp
Copy link

jonthomp commented Jun 29, 2022

@wraithgar @fritzy please can this be re-opened? I don't think it is a duplicate of #3403.

The bug here is that running npm version -w=<workspace> does not update package-lock.json

@wraithgar
Copy link
Member

~/D/n/s/ws (main|✔) $ npm version minor -w workspace-a
workspace-a
v1.1.0

added 2 packages in 469ms
~/D/n/s/ws (main|✚2) $ git diff package-lock.json 
diff --git a/package-lock.json b/package-lock.json
index 119a66b..08a7625 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -32,7 +32,7 @@
       "link": true
     },
     "workspace-a": {
-      "version": "1.0.0",
+      "version": "1.1.0",

It does though?

@jonthomp
Copy link

Sorry, I forgot to try it out on the latest npm, it does indeed work. We're currently on 8.5.5 where it does not. We will update. Thanks.

@surbhirverma
Copy link

surbhirverma commented Jul 21, 2022

this doesn't seem to work if my packages are not published to registry. It throws error 404 not in registry. There is already a bug reported for this #3940

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

4 participants