Yarn fails to install private GitLab package using instance-level registry setup.
I have successfully published a scoped package @myorg/mypackage to my GitLab instance using a project-level registry from a CI build. I can see the package my GitLab repository's Package Registry UI. I can also use browser to download the tar file. Installing the package to npm project succeeds using the instance-level registry and a personal access token.
.npmrc contents (anonymized)
@myorg:registry=https://myorgsgitlab:port/api/v4/packages/npm/
//myorgsgitlab:port/api/v4/packages/npm/:_authToken=asdf
always-auth=true
However, if I try using yarn, the installation fails with the following:
info No lockfile found.
[1/4] Resolving packages...
verbose 0.1727709 Performing "GET" request to "https://myorgsgitlab:port/api/v4/packages/npm/@myorg%2fmypackage".
verbose 0.5582721 Request "https://myorgsgitlab:port/api/v4/packages/npm/@myorg%2fmypackage" finished with status code 200.
[2/4] Fetching packages...
verbose 0.689239 Performing "GET" request to "https://myorgsgitlab:port/api/v4/projects/27/packages/npm/@myorg/mypackage/-/@myorg/mypackage-1.0.2.tgz".
verbose 0.7588204 Error: https://myorgsgitlab:port/api/v4/projects/27/packages/npm/@myorg/mypackage/-/@myorg/mypackage-1.0.2.tgz: Request failed "404 Not Found"
at ResponseError.ExtendableBuiltin (C:\Users\vivid\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:696:66)
So I tried adding another line to .npmrc
//myorgsgitlab:port/api/v4/projects/27/packages/npm/:_authToken=asdf
The same error is still occurring.
If I change the @myorg:registry setting to the project specific address (the one with /projects/27/) the installation succeeds. However, that is not an option as I have multiple packages under @myorg scope and they come from different repositories (project ids).
- Yarn version v1.22.18
- GitLab version 14.9.0