我正在尝试为 NPM 项目设置 Github 包,但遇到了一些问题。
我在特定组织下有一个仓库:
my-orgname/my-repo-name
这个仓库是私有的
my-orgname/my-repo-name
repo 中的代码包含一个 NPM 模块。
项目中的 package.json
{
"name": "@my-orgname/my-repo-name",
"version": "1.0.0",
"description": ".....",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"repository": {
"type": "git",
"url": "https://github.com/my-orgname/my-repo-name"
},
.....
.npmrc 在项目文件夹中
registry=https://npm.pkg.github.com/my-orgname
~/.npmrc 文件
//registry.npmjs.org/:_authToken=<TOKEN>
//npm.pkg.github.com/:_authToken=<TOKEN>
从项目文件夹中..
npm publish
结果是
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/@my-orgname%2fmy-repo-name - The expected resource was not found.
npm ERR! 404
npm ERR! 404 '@my-orgname/my-repo-name@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.