45

I've been trying to publish my package to the NPM Registry.
I get an error that I am not allowed to push my package to the registry.

403 Forbidden - PUT https://registry.npmjs.org/qdb - You do not have permission to publish "qdb". Are you logged in as the correct user?

I wonder why.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Smally
  • 1,556
  • 1
  • 8
  • 27

18 Answers18

85

It looks like a package with that name was already published by someone else, so you'd need to use a different name in your package.json file and then npm publish again.

Else, you can look if you're trying to publish the same version that's already published.

Smally
  • 1,556
  • 1
  • 8
  • 27
Shodipo Ayomide
  • 1,329
  • 13
  • 20
77

For me, I received this 403 error message when I had just created my NPM account, but not verified the email address on my account. I found the verification request email from NPM, clicked the link, and magically was able to publish my first package.

Henry Mueller
  • 1,309
  • 9
  • 8
7

Happens either because of a duplicate package name or because you never verified your email address.

Alon Carmel
  • 660
  • 1
  • 6
  • 16
5

Check if you are publishing the same version. I needed to update the version of the package and npm publish again. From the Forbidden error that I was getting it was not obvious.

Vallerious
  • 570
  • 6
  • 13
5

check your email registration and confirm verification
finaly repeat publish your package
and i hope will work

Muhammad Ichsan
  • 193
  • 2
  • 6
5

Don't forget that you need to be logged-in.

Run npm login to be able to publish packages.

Guilherme Samuel
  • 459
  • 6
  • 11
3

Also happens when an org name is already taken. Use the following URL:

https://www.npmjs.com/org/ORG_NAME_HERE

If you're getting a "404 Not Found" error, it means the name is free. Otherwise it is not.

Paul Razvan Berg
  • 16,949
  • 9
  • 76
  • 114
3

There Could be many reasons for that

  1. Email not verified, so first verify your email with npmjs.com
  2. Someone else is using that same package name, it needs to be unique. So choose a unique name. You can change the name under package.json file.
  3. If you are republishing same package with changes you made , you need to change version , eg - 1.0.0 to 1.0.1. You can change the varsion name under package.json file as well.
Vansh Bhardwaj
  • 427
  • 5
  • 9
2

I just verified my email and error gone. Now I can publish my packages.

ASANIAN
  • 372
  • 2
  • 8
2

For me there was another project with the same name. I just change the name and npm publish then it works good.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 14 '22 at 01:39
2

Another reason for this error is that your package name conflicts with an existing published package. NPM thinks that's the package you're trying to publish, and obviously, you don't have permission for it

rodrigomd
  • 171
  • 1
  • 3
1

change name like that(also the version) sample

  "name": "npm-helloworld-testwwwyy-xx",
  "version": "1.0.3"
kadamb
  • 1,532
  • 3
  • 29
  • 55
1

If you are using scope, the following conditions need to be met:

  • Publishing to your user scope (example: @username/module)
  • Publishing to an organization scope (example: @org/module)

@see https://docs.npmjs.com/cli/v8/using-npm/scope#publishing-public-scoped-packages-to-the-primary-npm-registry

nnmax
  • 71
  • 4
0

For me it was duplicate package name. Changing package name in package.json did the trick. There could be other two reasons:

  1. Try npm whoami . If you do not have username displayed try npm login.

  2. If you are trying to re-publish make sure you run npm version major/minor/patch as per your need.

aspxsushil
  • 514
  • 1
  • 5
  • 16
0

In my case I had different email in my npm config than what my npm login is set up with.

So basically your email displayed via npm config ls -l should match the email specified in your npmjs.com account.

vivekmore
  • 403
  • 5
  • 19
0

if you publish with NPM_TOKEN be sure it has publish permission, not read-only

Sh eldeeb
  • 1,589
  • 3
  • 18
  • 41
0

If you have already verified your NPM account, then the package name is already taken. You can use a scoped package name in this case. For example, change the package name in your package.json from 'some-package' to '@awesome-packages/some-package'

NPM will try to make a scoped package private by default (which is a paid feature) so below is the proper way to publish it:

$ npm publish --access=public
christian_js
  • 298
  • 3
  • 11
-1

This case of issue happen even though email is verified if you are Ubuntu user.

Add sudo cmd before npm login,

sudo npm login

Also use sudo while publish a module

sudo npm publish