node.js - 无法将 npm 包发布到 GitHub 包
问题描述
我正在尝试将 npm 包发布到 GitHub 包注册表。这是我的package.json
文件和.npmrc
文件
包.json
{
"name": "@chathurabuddi/constants",
"version": "1.0.0",
"description": "All constants",
"main": "index.js",
"repository": {
"type": "git",
"url": "git://github.com/chathurabuddi/contants.git"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"keywords": [
"chathurabuddi",
"constants"
],
"author": "chathurabuddi",
"homepage": "http://chathurabuddi.lk",
"license": "ISC"
}
.npmrc
chathurabuddi@registry=https://npm.pkg.github.com
但是当我尝试运行时npm publish
,它给了我以下错误。
C:\Users\CHATHURA\IdeaProjects\constants>npm publish
npm notice
npm notice package: @chathurabuddi/constants@1.0.0
npm notice === Tarball Contents ===
npm notice 201B index.js
npm notice 437B package.json
npm notice 917B .github/workflows/npm-publish.yml
npm notice === Tarball Details ===
npm notice name: @chathurabuddi/constants
npm notice version: 1.0.0
npm notice package size: 889 B
npm notice unpacked size: 1.6 kB
npm notice shasum: bf9cefa335b89aa1bd3950a7f7d953259f891f40
npm notice integrity: sha512-n1GLzxFtEaklV[...]d5u0bMDQXVHiQ==
npm notice total files: 3
npm notice
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/@chathurabuddi%2fconstants - The expected resource was not found.
npm ERR! 404
npm ERR! 404 '@chathurabuddi/constants@1.0.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\CHATHURA\AppData\Roaming\npm-cache\_logs\2021-06-27T02_58_58_228Z-debug.log
请注意,我已经通过运行登录到 npm npm login -registry=https://npm.pkg.github.com
。用于登录的个人访问令牌包括所需的所有权限repo
、package:read
和package:write
。
我已经尝试了几篇帖子中建议的几种解决方案,但都没有奏效。
有谁知道这个问题的确切问题是什么?
解决方案
您似乎拼错了存储库 URL。
"url": "git://github.com/chathurabuddi/contants.git"
应该改为
"url": "git://github.com/chathurabuddi/constants.git"
在package.json
.
推荐阅读
- json - 10 次中有 1 次出现错误 json.decoder.JSONDecodeError: Expecting ','
- python - 列表中的 XGBoost 功能重要性
- angular - 如何将角度单元测试写入组件外部的函数
- python - 如何在 VSCode 中获取一般 pyd 文件和 confluent_kafka 的参数提示?
- node.js - Flutter + FCM:java.lang.IllegalArgumentException:不支持的值:Bundle[mParcelledData.dataSize=100]
- c# - 为什么我可以从计算机堆栈c#的末尾访问数据
- python - 为什么这个 django url 不在 Mac 上运行?
- r - 使用 openxlsx 包的工作表链接问题
- node.js - 无法从猫鼬模型中获得文档“查找”承诺
- web - 如何使用思维导图导航创建网站