npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm publish --dry-run: Show which registry the package will go to

I’m running a custom NPM registry for some of my packages and in a few cases I publish them via CLI (instead of a CI task).

It happened to me before that I accidentally misspelled the --registry=".." flag and NPM attempted to publish the package to the public registry (which I did not want in this case).

To prevent cases like these, it would be very helpful to see to which registry NPM would publish the package to when performing a dry run (--dry-run).

This would help verifying that either the CLI command flags, the publishConfig in package.json or the scope-to-registry mapping in .npmrc are set correctly instead of publishing the package to the wrong end.