【发布时间】:2021-08-23 12:22:00
【问题描述】:
我成功地在我组织的私有 GitLab 存储库中发布了一个包。在我的全局和本地 .npmrc 配置文件中,我有以下内容:
# Set URL for your scoped packages.
@<main-package-name>:registry=https://gitlab.<my-organisation-domain>/api/v4/packages/npm/
'//gitlab.<my-organisation-domain>/api/v4/packages/npm/:_authToken'="<my-token>"
'//gitlab.<my-organisation-domain>/api/v4/projects/<my-project-id>/packages/npm/:_authToken'="<my-token>"
在 package.json 文件中,我具有以下属性:
"publishConfig": {
"@<main-package-name>:registry": "https://gitlab.<my-organisation-domain>/api/v4/projects/<my-package-id>/packages/npm/"
},
"name": "@<main-package-name>/<library-name>",
...
在 GitLab 包和注册表项目的页面上,它显示以下内容:
安装
npm i @<main-package-name>/<library-name>注册表设置
echo @<main-package-name>:registry=https://gitlab.<my-organisation-domain>/api/v4/packages/npm/ >> .npmrc
我在项目的 package.json 中添加了 "@<main-package-name>/<library-name>": "~0.0.11",但是当我尝试运行 npm install 时,我得到:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@<main-package-name>/<library-name> - Not found
npm ERR! 404
npm ERR! 404 '@<main-package-name>/<library-name>@~0.0.11' 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! /path/to/log
它似乎试图从 npmjs 而不是指定的 GitLab 注册表中获取包。有人可以帮忙吗?
【问题讨论】: