找不到纱线私有 gitlab 注册表 .tgz [英] Yarn private gitlab registry .tgz not found

查看:43
本文介绍了找不到纱线私有 gitlab 注册表 .tgz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我向 gitlab 提供的私有 npm 注册表发布了一个 npm 包.不,我尝试在另一个项目中安装该软件包.

I publish a npm package to my private npm registry provided by gitlab. No I try to install the package in another project.

身份验证通过位于项目根目录中的 .npmrc 完成.

The authentication is done via .npmrc which is located in the project root.

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

我尝试通过纱线安装软件包.

I try to install a the package via 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\"".

我认为这不是身份验证的问题,因为第一个请求是成功的.有人知道如何让它发挥作用吗?

I think it is not a problem with authentication because the first requests is successful. Dose anyone has an idea how to get this to work?

推荐答案

在对我有用的 .npmrc 文件中附加这一行:

Append this line on .npmrc file working for me:

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

这篇关于找不到纱线私有 gitlab 注册表 .tgz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆