[BUG] `publishConfig.tag` Not Respected
Is there an existing issue for this?
- [x] I have searched the existing issues
This issue exists in the latest npm version
- [x] I am using the latest npm
Current Behavior
npm publish doesn't respect publishConfig.tag in package.json, only the --tag CLI flag is respected.
Relate issue https://github.com/jonchurch/semversyphus/issues/2
Expected Behavior
Respect publishConfig.tag in package.json if the --tag CLI flag is not provided.
Steps To Reproduce
https://stackblitz.com/edit/stackblitz-starters-8defdmxd?file=index.js
npx -y npm@latest publish --dry-run
npm notice
npm notice package: [email protected]
npm notice Tarball Contents
npm notice 97B index.js
npm notice 95B package.json
npm notice Tarball Details
npm notice name: node-starter
npm notice version: 0.0.0
npm notice filename: node-starter-0.0.0.tgz
npm notice package size: 269 B
npm notice unpacked size: 192 B
npm notice shasum: b5b93343a4abe41d7ed2ac5ca7e6c7fa6ddc25e0
npm notice integrity: sha512-Ln6+ML5+Jdxav[...]7ZADYLajLINgQ==
npm notice total files: 2
npm notice
npm warn This command requires you to be logged in to https://registry.npmjs.org/ (dry-run)
npm notice Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)
+ [email protected]
Environment
- npm: 11.6.3
- Node.js: v24.11.1
- OS Name: macOS / Stackblitz
- System Model Name: Macbook Pro / Chrome
- npm config:
; "user" config from /home/.npmrc
global-pnpmfile = "~/.pnpm/.pnpmfile.cjs"
ignore-dep-scripts = true
prefer-symlinked-executables = true
update-notifier = false
verify-store-integrity = false
; node bin location = /usr/local/bin/node
; node version = v20.19.1
; npm local prefix = /home/projects/stackblitz-starters-8defdmxd
; npm version = 10.8.2
; cwd = /home/projects/stackblitz-starters-8defdmxd
; HOME = /home
; Run `npm config ls -l` to show all defaults.
; "publishConfig" from /home/projects/stackblitz-starters-8defdmxd/package.json
; This set of config values will be used at publish-time.
tag = "beta"
We use pnpm as our package manager, but publishing still goes through npm under the hood. When we run pnpm publish -r to publish all packages recursively, we rely on publishConfig.tag to control distribution tags. However, since --tag is not forwarded to npm during publish, all packages are published as latest instead of using the configured tag.
It appears that publishConfig.tag is being ignored when using pnpm publish -r, and there’s currently no way to apply custom tags per package without manually passing --tag.
As a temporary workaround, we wrote a custom script that iterates through each package directory and runs npm publish with the appropriate --tag value. While this works, it defeats the purpose of using the built-in recursive publish command.