【问题标题】:problem with owner repositories in npm and package.json _ npm ERR! 400 Bad Request (npm publish)npm 和 package.json _ npm ERR 中的所有者存储库有问题! 400 错误请求(npm 发布)
【发布时间】:2021-02-27 01:25:26
【问题描述】:

我有一个 GitHub 帐户,其中包含我的 昵称 作为名为 fraybabak 的用户名。 在 npm 中,我有一个名为我的 babakabadkheir 的用户名。所以我正在尝试将我的第一个包发布到 npm 。

在我的 package.json 文件中我有这个:

  "bugs": {
    "url": "https://github.com/fraybabak/smart_random/issues"
  },
  "repository":{
    "url":"https://github.com/fraybabak/smart_random.git"
  },
  "publishConfig": { "registry": "https://npm.pkg.github.com/" },
  "homepage": "https://github.com/fraybabak/smart_random#readme"

我知道我的用户名和范围不同。 我尝试使用以下方式登录:

npm login --registry=https://npm.pkg.github.com

并在密码字段中使用 access_token 向 GitHub 进行身份验证。

登录成功

所以现在当我尝试发布时:

npm publish

我收到此错误:

npm ERR! code E400
npm ERR! 400 Bad Request - PUT https://npm.pkg.github.com/@babakabadkheir%2fsmart_random - scope 'babakabadkheir' in package name '@babakabadkheir/smart_random' does not match repo owner 'fraybabak' in repository element in package.json

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/babyjesus/.npm/_logs/2020-11-15T17_41_09_392Z-debug.log

【问题讨论】:

    标签: node.js github npm package.json


    【解决方案1】:

    尝试像这样更新您的package.json

      "repository":{
        "url":"https://github.com/fraybabak/smart_random"
      },
      "publishConfig": { "registry": "https://npm.pkg.github.com/@fraybabak" },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-11
      • 1970-01-01
      • 1970-01-01
      • 2013-05-25
      • 1970-01-01
      • 2013-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多