npm - 未找到 yarn 私有(private) gitlab 注册表 .tgz

标签 npm gitlab yarnpkg npm-registry

我将一个 npm 包发布到我由 gitlab 提供的私有(private) npm 注册表。不,我尝试将包安装在另一个项目中。
身份验证通过 .npmrc 完成它位于项目根目录中。

registry=https://registry.yarnpkg.com/
@myorg:registry=https://gitlab.myorg.com/api/v4/packages/npm/
//gitlab.myorg.com/api/v4/packages/npm/:_authToken=XXXX
always-auth=true
我尝试通过 yarn 安装包。
yarn add @myorg/mypackage --verbose
该命令失败并出现此错误
verbose 0.845938752 Request "https://gitlab.trustify.dev/api/v4/packages/npm/@trustifych%2freview-importer" finished with status code 200.
[...]
verbose 2.567404115 Performing "GET" request to "https://gitlab.myorg.com/api/v4/projects/8/packages/npm/@myorg/mypackage/-/@myorg/mypackage-1.0.1.tgz".
verbose 2.669180133 Error: https://gitlab.myorg.com/api/v4/projects/8/packages/npm/@myorg/mypackage/-/@myorg/mypackage-1.0.1.tgz: Request failed "404 Not Found"
    at ResponseError.ExtendableBuiltin (/usr/local/lib/node_modules/yarn/lib/cli.js:696:66)
    at new ResponseError (/usr/local/lib/node_modules/yarn/lib/cli.js:802:124)
    at Request.<anonymous> (/usr/local/lib/node_modules/yarn/lib/cli.js:67058:16)
    at Request.emit (events.js:315:20)
    at Request.module.exports.Request.onRequestResponse (/usr/local/lib/node_modules/yarn/lib/cli.js:141539:10)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient (_http_client.js:641:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:509:22)
    at TLSSocket.emit (events.js:315:20)
error An unexpected error occurred: "https://gitlab.myorg.com/api/v4/projects/8/packages/npm/@myorg/mypackage/-/@myorg/mypackage-1.0.1.tgz: Request failed \"404 Not Found\"".
我认为这不是身份验证的问题,因为第一个请求是成功的。剂量有人知道如何让它工作吗?

最佳答案

将此行附加到 .npmrc为我工作的文件:

'//gitlab.com/api/v4/projects/<proj-id>/packages/npm/:_authToken'="${GITLAB_AUTH_TOKEN}"

关于npm - 未找到 yarn 私有(private) gitlab 注册表 .tgz,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67126813/

相关文章:

node.js - 为什么全局 npm 包没有启动模块依赖性?

git - 如何在私有(private) GitLab 存储库中使用 Go

Gitlab无法在服务器上克隆,但可以在客户端克隆

npm - 有没有办法获取传递给该脚本指定的命令的 npm 脚本的名称?

reactjs - 如何让我的 React 应用程序仍然以 lint 错误运行?

javascript - 语法错误 : Unexpected token angular-cli

angular - 构建错误 : Two different types with this name exist, 但它们不相关

yarnpkg - 如何通过 yarn 工作区在应用程序中添加多个工作区

angular - 如何删除 Angular 6 中的 dist 文件?

gitlab - 如何在 Gitlab 中以警告完成作业