NPM Publish Error 402 Payment Required – You must sign up for private packages

When publishing public scoped packages you might get the following errors:

npm ERR! code E402
npm ERR! 402 Payment Required - PUT https://registry.npmjs.org/.... - You must sign up for private packages

This happens when trying to publish public scoped packages. The default access level is private. To resolve this you can either set npm config set access public or add the following to your package.json:

"publishConfig": {
  "access": "public",
  "registry": "https://registry.npmjs.org/"
},

Leave a Reply

Your email address will not be published. Required fields are marked *