npm publish Failed PUT 402
You're using NPM Scoped packages. They are private by default which requires paying NPM for a private account. If your package is public, you can use the --access=public
flag like this:
npm publish --access=public
First create the org: https://www.npmjs.com/org/create
Then run npm publish --access public
You can solve the problem by adding the following to your package.json
file:
package.json
"publishConfig": {
"access": "public"
}
The publishConfig value manages the visibility of your package. If you define "public" access, then your package can be downloaded by everyone from the npm registry.
If you define "restricted" access, then consumers of your package have to add a .npmrc
file to their own package in order to set an access token:
.npmrc
always-auth=true
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Note: You don't need the .npmrc
file when you use "public" access.