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 publish -ws is failing #7907

Open
2 tasks done
manchuck opened this issue Nov 12, 2024 · 4 comments
Open
2 tasks done

[BUG] npm publish -ws is failing #7907

manchuck opened this issue Nov 12, 2024 · 4 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@manchuck
Copy link

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 you run npm publish -ws, it will go through and publish all those packages. However, if one of those packages is not updated, the command will fail since NPM rejects publishing the same version.

Expected Behavior

Running npm publish -ws will keep publishing the other packages even if one fails

Steps To Reproduce

Create a workspace with three packages (A, B, C)
Bump the versions for A and C
Run npm publish -ws
B will fail to publish and npm will not try to publish C

Environment

  • npm: 10.8.3
  • Node.js: v22.9.0
  • OS Name: MacOS
  • System Model Name: Macbook Pro
  • npm config:
; "user" config from /Users/manchuck/.npmrc

//registry.npmjs.org/:_authToken = (protected)
save-exact = true
save-prefix = ""

; node bin location = /Users/manchuck/.nvm/versions/node/v22.9.0/bin/node
; node version = v22.9.0
; npm local prefix = /Users/manchuck/Projects/vonage/node-sdk
; npm version = 10.8.3
; cwd = /Users/manchuck/Projects/vonage/node-sdk/packages
; HOME = /Users/manchuck
; Run `npm config ls -l` to show all defaults.
@manchuck manchuck added Bug thing that needs fixing Needs Triage needs review for next steps labels Nov 12, 2024
@manchuck
Copy link
Author

I am opening this as an issue again because if this is intended, then it is poorly implemented. As a workaround for this, a user now has to run a bash script to publish packages when there is no change in the version number for one package in the monorepo:

for i in $(ls -d *)                                                                                                                          ─╯
(cd $i && npm publish)

I'm not sure how this is a breaking change for a fix. Even if this was some breaking change, the remedy is to just add a new flag that can adjust the behavior without changing how it works. Something like --ignore-publish-fail

@manchuck manchuck changed the title [BUG] <title> [BUG] npm publish -ws is failing Nov 13, 2024
@kchindam-infy
Copy link

@manchuck Bumping the versions A and C and runs the npm publish -ws it publishes other packages even if one fails. It is working as you expected not getting any ERROR it publishes packages except which are not bumped or updated

@manchuck
Copy link
Author

manchuck commented Jan 8, 2025

@kchindam-infy Correct, I am not getting an error when running the command; I am getting an error when trying to publish to npmjs.org since package B has not bumped its version.

@kchindam-infy
Copy link

@manchuck The publish will fail if the package name and version combination already exists in the specified registry Once a package is published with a given name and version, that specific name and version combination can never be used again, even if it is removed with [npm unpublis]. Refer to the documentation of npm publish which is given below
https://docs.npmjs.com/cli/v11/commands/npm-publish.. its working by design .

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
Projects
None yet
Development

No branches or pull requests

2 participants