npm - GitLab-CE 13.7.4:NPM 发布 404 Not Found - PUT
问题描述
我正在尝试在自托管 GitLab 上发布私有 NPM 包。为此,我创建了一个 GitLab 项目,其中ID = 9
包含 , 来托管我需要的所有 NPM 包。
该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}
解决方案
推荐阅读
- python-2.7 - 带有 EC2 的多线程 Python
- sql-server - 创建数据透视表时 SQL 语法不正确
- android - Firebase 云消息不会传送到 Wear OS 设备
- python - 用 python 和 Flask 改变 CSS
- r - 协助通过 R 自动进行 SFTP 传输
- javascript - jQuery DataTable Row Details 给出“数据未定义”
- tensorflow - 我将张量添加为后端,然后出现 AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' 之类的错误
- django - mac django error 你安装了mysqlclient还是MySQL-python?
- javascript - 将 createElement 分配给 React 中的变量
- docker - Docker Kong 管理 API 无法访问