Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yarn add - Private package - 404 Not Found

Tags:

yarnpkg

I want to install a private package hosted on an internal Gitlab with Yarn. So, I configured my .npmrc with this informations :

@mypackage:registry=https://gitlab.intra/api/v4/packages/npm/
//gitlab.intra/api/v4/projects/819/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/packages/npm/:_authToken=xxxxx
always-auth=true

When I attempt to install the package with yarn add @mypackage/lib-node-client, Yarn give me an error :

Trace: 
  Error: https://gitlab.intra/api/v4/projects/725/packages/npm/@mypackage/lib-node-common/-/@mypackage/lib-node-common-21.7.1.tgz: Request failed "404 Not Found"
      at ResponseError.ExtendableBuiltin (/usr/lib/node_modules/yarn/lib/cli.js:696:66)
      at new ResponseError (/usr/lib/node_modules/yarn/lib/cli.js:802:124)
      at Request.<anonymous> (/usr/lib/node_modules/yarn/lib/cli.js:67062:16)
      at Request.emit (node:events:369:20)
      at Request.module.exports.Request.onRequestResponse (/usr/lib/node_modules/yarn/lib/cli.js:141640:10)
      at ClientRequest.emit (node:events:369:20)
      at HTTPParser.parserOnIncomingClient (node:_http_client:646:27)
      at HTTPParser.parserOnHeadersComplete (node:_http_common:129:17)
      at HTTPParser.execute (<anonymous>)
      at TLSSocket.socketOnData (node:_http_client:512:22)

So, Yarn can't find the URL : https://gitlab.intra/api/v4/projects/725/packages/npm/@mypackage/lib-node-common/-/@mypackage/lib-node-common-21.7.1.tgz

If I try to get this on my browser, I can download the package...

If anyone can help me please, thank's for all :)

like image 211
iamalexly Avatar asked Oct 28 '21 15:10

iamalexly


People also ask

How do you add devDependencies to yarn?

You can also add other types of dependencies using flags: yarn add --dev to add to devDependencies. yarn add --peer to add to peerDependencies. yarn add --optional to add to optionalDependencies.

What is .yarnrc file?

. yarnrc files allow you to configure additional Yarn features. The config command may also be used to set these options. Yarn will merge .

What is yarn Add in npm?

Yarn is a package manager for Node. js that focuses on speed, security, and consistency. It was originally created to address some issues with the popular NPM package manager.

Can yarn install npm packages?

Yarn can consume the same package. json format as npm, and can install any package from the npm registry. This will lay out your node_modules folder using Yarn's resolution algorithm that is compatible with the node.


1 Answers

In your .npmrc file, you tell how to connect to GitLab for the project 819. The error is about the project 725. GitLab simply refuse the connexion.

Try with

@mypackage:registry=https://gitlab.intra/api/v4/packages/npm/
//gitlab.intra/api/v4/projects/725/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/projects/819/packages/npm/:_authToken=xxxxx
//gitlab.intra/api/v4/packages/npm/:_authToken=xxxxx
always-auth=true
like image 114
Joel Avatar answered Oct 16 '22 09:10

Joel