Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm ERR! 403 403 Forbidden npm publish

Tags:

node.js

npm

I try to publish public package on npm but I have this error

npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/@clem_b%2fweather - Forbidden
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.

So in first watch my package.jsonbelow.

{
  "name": "@clem_b/weather",
  "version": "1.0.6",
  "description": "weather cli",
  "main": "build/main.js",
  "types": "build/main.d.ts",
  "homepage": "https://github.com/ClementBolin/weatherCLI#readme",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/ClementBolin/weatherCLI.git"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "rimraf ./build && tsc",
    "start": "npm run build && node build/mai.js"
  },
  "bin": {
    "app": "bin/weatherCLI"
  },
  "keywords": [
    "weather",
    "today",
    "rain",
    "sun"
  ],
  "author": "clem_b",
  "license": "MIT",
  "devDependencies": {
    "@types/minimist": "^1.2.0",
    "@types/node": "^14.14.6",
    "@types/oauth": "^0.9.1",
    "@types/ora": "^3.2.0",
    "rimraf": "^3.0.2",
    "tslint": "^6.1.3",
    "typescript": "^4.0.5"
  },
  "prepublish": "npm run build",
  "dependencies": {
    "minimist": "^1.2.5",
    "oauth": "^0.9.15",
    "ora": "^0.3.0"
  }
}

So after end to write my code, I decide to publish my code on npm, so I create npm account, I use npm loginfor connect to my account. After this I run the following command npm publish --access publicand I have error write in top. I search on many topics, but I don't find solution

like image 684
Rayder-_- Avatar asked Dec 23 '22 16:12

Rayder-_-


2 Answers

just ran into this myself. I created a new NPM account and then immediately authenticated via npm login.

Then, I ran npm publish --access public and received the exact same error message.

I was able to resolve the issue by verifying my email account for NPM (doh).

like image 70
pnl data Avatar answered Jan 21 '23 19:01

pnl data


Probably there is already a package with the same name present on npm. Change package name in package.json and try again.

like image 33
sudip-modi Avatar answered Jan 21 '23 17:01

sudip-modi