Npm publish to private scope keeps failing

I’ve recently created a new Organization and went for the paid plan to publish unlimited private packages.

However, each time I try to publish my package to my Org, it keeps giving me the following error:

npm ERR! publish Failed PUT 403
npm ERR! code E403
npm ERR! Forbidden : @myScopeName/myPackageName

I’ve already logged out and then logged in as a scope; like this:

npm login scope=myScopeName

Which then returns the following

logged in as myUserName to scope @myScopeName on http://registry.npmjs.org/

And I’ve checked my .npmrc file and I have the following lines:

@myScopeName:registry=http://registry.npmjs.org/
//registry.npmjs.org/:_authToken=MyAuthToken

Yet I still can’t publish my package. Does anyone know if I’ve forgotten something else or if I did something wrong according to the above?

Thank you!

PS: I did found simular questions of people with the same problem, but none of them helped me. I also tried the npm logout and npm login again.

I found the problem and I should mention that I encountered a filename bug. I used an underscore for my package name and apparently, that was the problem. I changed my package name with dashes instead of underscores and then it published without any problems.

1 Like

I think this is actually a bug and should be transferred to the bug reports section.

(@JohannesB note there is a template to follow for #bugs.)

Thanks for update @ceeandimagine. There is a description of valid packages names here: https://docs.npmjs.com/files/package.json#name

@shadowspawn that is exactly the problem. That description states that you can include underscores in your package name. For private packages this is sadly not accurate. If you try to create a private npm package with an underscore in the name, it will simply not work and give you a 403 error. You can try that yourself if you want.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.