NPM Errors are sometimes opaque. Yesterday, while working on a personal npm package, I faced the following issue while publishing using usual command:
npm ERR! publish Failed PUT 400
npm ERR! code E400
npm ERR! unscoped packages cannot be private : my-package
What a random bug!
After looking a bit on the Internet, it seems that npm teams changed default npm publish command default arguments. You now have to specify that you want your package to be public. According to official documentation, we have two alternatives:
Explicitely add –access public argument to our publish command:
npm publish --access public
Or, you can edit your package.json file:
That should fix it!