I publish a npm package to my private npm registry provided by gitlab. No I try to install the package in another project.
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
The command fails with this error
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?
Append this line on .npmrc
file working for me:
'//gitlab.com/api/v4/projects/<proj-id>/packages/npm/:_authToken'="${GITLAB_AUTH_TOKEN}"