我正在试图上传一个包在GPR (Github包注册表)。我成功地登录:
npm login --registry=https://npm.pkg.github.com然后运行以下命令:
npm set registry https://npm.pkg.github.com/
npm publish返回此错误:
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/package-name
npm ERR! 404
npm ERR! 404 'package-name@version' is not in the npm registry.它似乎试图将包上载到npm注册中心,而不是github包注册中心。我该如何解决这个问题?
发布于 2019-09-17 09:37:16
解决这个问题有两种方法:
publishConfig中指定package.json选项"publishConfig": {
"registry":"https://npm.pkg.github.com/@OWNER"
},.npmrc文件添加到具有以下内容的项目中:registry=https://npm.pkg.github.com/@OWNER将OWNER替换为拥有存储库的GitHub上的用户或组织帐户的名称,您将在其中发布包。
发布于 2020-04-03 22:02:27
例如:
{
"name": "@elvisjs/calling-elvis",
"repository": {
"type": "git",
"url": "https://github.com/elvisjs/calling-elvis"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/elvisjs"
}
}必须匹配name、repository/url和publishConfig/registry。
发布于 2020-05-26 13:02:26
Github包注册表期望package.json上的名称属性为"@{github用户名}/{ Package }“,例如:-
"name": "@pravanjan/local-time",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},如果在publishConfig中没有设置“package.json”,我们可以直接在终端中设置注册表参数。
npm publish --registry=https://npm.pkg.github.com/ 这对我来说是有效的
https://stackoverflow.com/questions/57938784
复制相似问题