Tag Archives: Node.js

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/"
},

Fix Invalid Package Name “.DS_Store” for Node.js NPM Global Update on macOS

If you got the following error message when run npm update -g:

$ npm update -g
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name ".DS_Store": name cannot start with a period

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sparanoid/.npm/_logs/2021-04-28T13_59_32_013Z-debug.log

Simply run if you installed your Node.js via Homebrew:

find /usr/local -name '.DS_Store' -type f -print -delete

Or the following for M1:

find /opt/homebrew/lib -name '.DS_Store' -type f -print -delete