Search code examples
npmpackagepublishorganizationnpm-publish

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:

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!


Solution

  • 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.