Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM: 403 forbidden - PUT http://registry.npmjs.org/[package-name] - Forbidden

I am trying to create npm vue component library. I have been working through all the steps but stuck at npm publish.

Please see the below error screenshot for which I am unable to find a solution on google after trying more than an hour(The error message is not that accurate IMHO or maybe I am not able to catch it).

enter image description here

For reference package.json

{
  "name": "@satyam/vue-components",
  "version": "0.1.0",
  "main": "./dist/satyam.common.js",
  "files": [
    "dist"
  ],
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "build-library": "vue-cli-service build --target lib --name satyam ./src/components/index.js",
    "test:unit": "vue-cli-service test:unit",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.4",
    "vue": "^2.6.11"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.3.0",
    "@vue/cli-plugin-eslint": "~4.3.0",
    "@vue/cli-plugin-unit-jest": "~4.3.0",
    "@vue/cli-service": "~4.3.0",
    "@vue/eslint-config-standard": "^5.1.2",
    "@vue/test-utils": "1.0.0-beta.31",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.0",
    "eslint-plugin-vue": "^6.2.2",
    "node-sass": "^4.12.0",
    "sass-loader": "^8.0.2",
    "vue-template-compiler": "^2.6.11"
  }
}

After running npm audit

enter image description here

Any help will be appreciated :)

like image 884
Satyam Pathak Avatar asked May 04 '20 11:05

Satyam Pathak


4 Answers

This post has helped me moving past the 403 error, however, after confirming my account over the email link they send and after login into NPM I tried one more time, then I got the following error:

402 Payment Required - PUT https://registry.npmjs.org/@jcarbajal79%2fsimplelib3 - You must sign up for private packages.

If you have the same problem is because the library is being published as private, I checked my package.json and test the following:

No property: "private":"...". - does not work Property set "private":"true" - does not work Property set "private":"false" - does not work

Turns out you have to publish it as public from the command line:

%> npm publish --access=public. - Works!.

like image 145
Javier Carbajal Avatar answered Nov 10 '22 10:11

Javier Carbajal


Update: New user needs to confirm their account first

So after quite a few research and digging around, I found the real issue here.

It's probably documented somewhere very deep or in a light font, but I totally missed to find it.

Your package name should follow your npm username.

In my package.json name property is @satyam/vue-components where it should be @satyamninja/vue-components and that's it. I successfully published the package.

like image 35
Satyam Pathak Avatar answered Nov 10 '22 10:11

Satyam Pathak


If you are a new user, please confirm your account first!

like image 22
Hefaz Avatar answered Nov 10 '22 09:11

Hefaz


It sound like you are a new user. You need to confirm your account. Should have get email confirmation from npm site.

like image 4
Denise Ignatova Avatar answered Nov 10 '22 10:11

Denise Ignatova