无法将 npm 包发布到 GitHub 个包
Cannot publish npm package to GitHub packages
我正在尝试将 npm 包发布到 GitHub 包注册表。这是我的 package.json
文件和 .npmrc
文件
package.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\_logs21-06-27T02_58_58_228Z-debug.log
请注意,我已经通过 运行ning npm login -registry=https://npm.pkg.github.com
登录到 npm。用于登录的个人访问令牌包括所需的所有权限,repo
、package:read
和 package:write
。
我已经尝试了几个帖子中建议的几种解决方案并且 none 有效。
有谁知道这个问题的具体问题是什么?
您好像拼错了存储库 URL。
"url": "git://github.com/chathurabuddi/contants.git"
应该改为
"url": "git://github.com/chathurabuddi/constants.git"
在 package.json
.
我正在尝试将 npm 包发布到 GitHub 包注册表。这是我的 package.json
文件和 .npmrc
文件
package.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\_logs21-06-27T02_58_58_228Z-debug.log
请注意,我已经通过 运行ning npm login -registry=https://npm.pkg.github.com
登录到 npm。用于登录的个人访问令牌包括所需的所有权限,repo
、package:read
和 package:write
。
我已经尝试了几个帖子中建议的几种解决方案并且 none 有效。
有谁知道这个问题的具体问题是什么?
您好像拼错了存储库 URL。
"url": "git://github.com/chathurabuddi/contants.git"
应该改为
"url": "git://github.com/chathurabuddi/constants.git"
在 package.json
.