Search code examples
javascriptnode.jsnpmnpm-publish

While publishing npm, getting npm publish npm ERR! 403 Forbidden PUT https//registryname/ - forbidden


I am trying to publish the package using npm publish command. but I am getting this error every time.

npm ERR! code E403
npm ERR! 403 Forbidden - PUT https://registryname - forbidden

I have

"publishConfig": {
   "registry": "https://registryname"
}

and in .npmrc

registry=https://registryname

I have tried many solutions but no luck.


Solution

  • Do you have an account? You can;

    1. First check your account using npm whoami
    2. if you have an account then login, your session might be expired. npm login. Follow the login prompt.
    3. Then once you are logged in, make sure you are in the right directory, you wont be able to publish if you are not in the directory of the project you are working on.