npm Community Forum (Archive)

The npm community forum has been discontinued.

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

Failure to publish scoped package does not fail dry run

What I Wanted to Do

Detect failures to publish using the --dry-run option

What Happened Instead

Setting accessConfig to true is explicitly required for publishing public scoped packages. If this is not set, publishing fails. However, this is not the case when using the --dry-run option.

Reproduction Steps

Create a package.json with a scoped package name that does not yet exist in the npm repository. Do not add accessConfig configuration to package.json. Execute npm publish --dry-run. This should fail but does not.

Details

No logs as the operation succeeds.

Platform Info

$ npm --versions
{ '@danderson00/scopedPackage': '1.0.0',
  npm: '6.4.1',
  ares: '1.15.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.15.3',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.51',
  zlib: '1.2.11' }
$ node -p process.platform
win32


Related: publish --dry-run result in a failure if version already published


Thanks for linking the existing Idea @danderson00 . There is now an open “bug” and “idea” so interested readers have two places to case a vote. :-)


Some background on the requirement:

When automating the publishing of multiple packages, it’s good to do a “dry run” to pick up as many issues as possible before making any changes. Failing halfway through the process leaves one in a nasty state of version inconsistencies and requires somewhat painful manual intervention.