5

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:

registry=http://registry.npmjs.org/
scope=myScopeName
@myScopeName:registry=http://registry.npmjs.org

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!

Cédric Bloem
  • 1,447
  • 3
  • 16
  • 34
  • I see that you opened a report at [the official npm forums](https://npm.community/t/npm-publish-to-private-scope-keeps-failing/6274/2), could you convert this into a bug report? – JohannesB Mar 20 '19 at 11:25
  • Make sure you are logged in to the correct user: `npm login` and follow instructions. Then try to publish again. if that doesn't help, create a `.npmrc` file and [create a token](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) in the npm website and apply it to that local file. (place it on *gitignore*/*npmignore*) – vsync Sep 21 '20 at 10:25

2 Answers2

12

This is an error that can have many origins. I will list some of the possibilities below:

  1. Your email address is not validated.
  2. The package is assigned to a group, in which you are not present.
  3. The name of the package you provided is similar to a yet existing package name in your scope.
  4. A typo in the scope name.
  5. A malformed package name.
  6. ...

Through experimenting, I actually found out that the naming scheme for private npm packages is different than the one officially documented. It appears that privately pushed packages cannot contain underscores, and probably other stuff is also conflicting with the official documents.

JohannesB
  • 1,995
  • 21
  • 35
  • 1
    Thank you for your answer! I changed an underscore inside my package name to a dash and then the publishing worked. Weirdly enough, according to their [package.json documentation](https://docs.npmjs.com/files/package.json), this shouldn't have been a problem. – Cédric Bloem Mar 20 '19 at 12:04
  • in my case, email address was not verified. Once I verified, npm publish started working – Sohan Soni Apr 30 '21 at 13:30
0

I had the same issue. I had an unverified email address associated with the account. After verifying the account, I was able to publish the package. Check the name of the package if it is conflicting with another package with a similar name. That might be an issue.

Arjunken
  • 11
  • 1
  • 3