在 GitHub Packages 中发布具有自定义范围的 npm 包

问题描述 投票:0回答:1

我们正在尝试将自定义范围的包发布到 GitHub Packages。

例如

@foo/bar

问题是

@foo
不是 GitHub 所有者,这似乎是 package.json 中
name
的要求。

这就是我们的

package.json
的样子:

{
  "name": "@foo/bar",
  "version": "1.0.0",
  "publishConfig": {
    "registry": "https://npm.pkg.github.com/OWNER"
  }
}

当我们尝试此操作时,我们收到以下错误:

npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://npm.pkg.github.com/OWNER/@foo%2fbar - Permission not_found: owner not found
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.

即使我们在注册表 URL 上指定了所有者,它也显示未找到所有者。

我想知道是否支持发布自定义范围的包。

有人遇到过这个问题吗?

谢谢!

github npm github-packages
1个回答
0
投票

刚刚遇到了这个错误。 @namespace 将是 github 组织/个人帐户,如here所示,因此将

@foo
替换为它。例如,如果您的组织名为
my-org
,那么它将是:

{
   "name": "@my-org/bar",
   "version": "1.0.0",
   "publishConfig": {
      "registry": "https://npm.pkg.github.com/"
   },
   "repository": {
      "url": "https://github.com/my-org/<repository-this-package-belongs-to>"
   },
}
© www.soinside.com 2019 - 2024. All rights reserved.