如何解决GitLab-CE 13.7.4:NPM 发布 404 Not Found - PUT
我正在尝试在自托管的 GitLab 上发布私有 NPM 包。
为此,我创建了一个具有 ID = 9
的 GitLab 项目,以托管我需要的所有 NPM 包。
lib 的 package.json
是:
{
"name": "@myscope/api-client","version": "1.0.0",...
...
...
"publishConfig":{
"@myscope:registry": "https://gitlab.mydomain.eu/api/v4/projects/9/packages/npm/"
}
}
以下是 .npmrc
文件:
@myscope:registry=https://gitlab.mydomain.eu/api/v4/packages/npm/
//gitlab.mydomain.eu/api/v4/packages/npm/:_authToken=${GITLAB_AUTH_TOKEN}
//gitlab.mydomain.eu/api/v4/projects/9/packages/npm/:_authToken=${GITLAB_AUTH_TOKEN}
考虑到在线文档,我没有得到什么遗漏。
但是,在运行 npm publish
命令时出现 404 Not Found - PUT
错误。
提供的访问令牌具有所有权限,只是为了排除这种可能性。
$ GITLAB_AUTH_TOKEN=MyAccessToken npm publish dist
...
...
...
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://gitlab.mydomain.eu/api/v4/packages/npm/@myscope%2fapi-client
npm ERR! 404
npm ERR! 404 '@myscope/api-client@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.
更新
根据 https://docs.gitlab.com/ee/user/packages/npm_registry/index.html#authenticate-with-a-ci-job-token 上的文档,我也尝试了以下 .npmrc
,但没有成功。
@myscope:registry=https://gitlab.mydomain.eu/api/v4/projects/9/packages/npm/
//gitlab.mydomain.eu/api/v4/projects/9/packages/npm/:_authToken=${GITLAB_AUTH_TOKEN}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。