首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >npm错误403 403禁止npm发布

npm错误403 403禁止npm发布
EN

Stack Overflow用户
提问于 2020-11-07 00:29:00
回答 2查看 4.2K关注 0票数 4

我尝试在npm上发布公共包,但出现以下错误

代码语言:javascript
复制
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.

所以在下面先看我的package.json

代码语言:javascript
复制
{
  "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"
  }
}

所以在写完代码后,我决定在npm上发布我的代码,所以我创建了npm帐户,我使用npm login连接到我的帐户。在此之后,我运行以下命令npm publish --access public,我在顶部有错误写入。我搜索了许多主题,但没有找到解决方案

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-12-25 02:12:45

我自己也遇到了这个。我创建了一个新的NPM帐户,然后立即通过npm login进行身份验证。

然后,我运行npm publish --access public并收到完全相同的错误消息。

我能够通过验证我的NPM (doh)电子邮件帐户来解决这个问题。

票数 10
EN

Stack Overflow用户

发布于 2021-04-24 08:54:23

在我的案例中,问题在我创建了一个团队(在我的NPM组织内)并将我自己添加到该团队中后得到了解决。

请参阅:https://github.com/npm/cli/issues/1012#issuecomment-629546298

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64718308

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档