找不到-PUT https://npm.pkg.github.com/package-name [英] Not Found - PUT https://npm.pkg.github.com/package-name
本文介绍了找不到-PUT https://npm.pkg.github.com/package-name的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在GPR(Github软件包注册表)上上传软件包.我成功登录:
I'm trying to upload a package on GPR (Github Package registry). I log in successfully:
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软件包注册表上上传软件包.我该如何解决这个问题?
Seems it tries to upload a package on npm registry instead of github package registry. How should I fix this problem?
推荐答案
有两种方法可以解决此问题:
There are two ways to solve this problem:
- 在
package.json
中指定publishConfig
选项:
- Specify
publishConfig
option inpackage.json
:
"publishConfig": {
"registry":"https://npm.pkg.github.com/@OWNER"
},
- 将
.npmrc
文件添加到您的项目中,内容如下:
- Add
.npmrc
file to your project with this content:
registry=https://npm.pkg.github.com/@OWNER
在拥有要在其中发布软件包的存储库的GitHub上用用户或组织帐户的名称替换OWNER
.
replacing OWNER
with the name of the user or organization account on GitHub that owns the repository where you will publish the package.
这篇关于找不到-PUT https://npm.pkg.github.com/package-name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文