Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

540
Visualizações
.npmrc ignored private package

I am trying to use my first private npm package on a gitlab private instance

I added @ajouve:registry=https://gitlab.my-website.io/api/v4/packages/npm/ to .npmrc

the command npm get seems to return the correct config

; "project" config from /Volumes/Work/service/.npmrc

@ajouve:registry = "https://gitlab.my-website.io/api/v4/packages/npm/" 

; "cli" config from command line options

omit = [] 
user-agent = "npm/7.5.4 node/v12.18.1 darwin x64" 

; node bin location = /usr/local/bin/node
; cwd = /Volumes/Work/service
; HOME = /Users/ajouve
; Run `npm config ls -l` to show all defaults.

But when I want to add the package

npm install --save @ajouve/my-module

I have

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@ajouve/my-module Not found
npm ERR! 404 
npm ERR! 404  '@ajouve/my-module@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ajouve/.npm/_logs/2021-03-19T15_06_50_186Z-debug.log

It goes to https://registry.npmjs.org

Running npm config ls -l | grep registry

I have

metrics-registry = "https://registry.npmjs.org/"
registry = "https://registry.npmjs.org/"
@ajouve:registry = "https://gitlab.my-website.io/api/v4/packages/npm/"
over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Instead of git://, use git+ssh://

npm i -S git+ssh://git@gitlab.com:<org>/<project>.git

Here you can get several answers

Install npm module from gitlab private repository

over 4 years ago · Santiago Trujillo Relatório

0

As someone who started using Gitlab's registry a couple days ago, i ran on the same issue. On the .npmrc, the scope name has to meet with your packet scope. For example, if we have the project A, it's package.json should be like this:

{
"name": "@myscope/myproject",
...Rest of your package.json

And on your project B, the .npmrc must match the scope

@myscope:registry=https://gitlab.com/api/v4/packages/npm/

Then after, make sure you authenticate with the scoped registry, otherwise NPM will throw a error or ignore and go search on NPM Registry

$ npm config set @myscope:registry https://gitlab.com/api/v4/packages/npm/
$ npm config set -- '//gitlab.com/api/v4/packages/npm/:_authToken' "<your_token>"

NOTE: <your_token> should be a access token created on your Gitlab Profile. You can create this by going on Preferences > Access Tokens. Make sure to check "read_registry" before creating the token.

Then, you can install your package easily

$ npm install --save @myscope/myproject

EDIT: If you are using a self-hosted gitlab instance, it follows the same, just remember to change "gitlab.com" to your gitlab instance url.

over 4 years ago · Santiago Trujillo Relatório

0

Try this, it should work.

npm install --save @ajouve/my-module --registry=https://gitlab.my-website.io/api/v4/packages/npm/ 

Another way is to create group endpoint in the private instance which will point hosted + proxy to public packages and update your registry to point to that endpoint so both private and public packages will work.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda