question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lerna bootstrap fails with a 401 in CI with a nexus repository

See original GitHub issue

Hello ! Thanks for the good work, lerna’s been a breeze for us, except in my corporate CI configuration aha.

So we’re having trouble with a simple lerna bootstrap when run in Jenkins CI.

Context

We’re using a custom nexus repository where the following configuration works locally on our posts :

lerna.json

{
    "npmClient": "npm",
    "packages": [
        "packages/*"
    ],
    "version": "0.5.0"
}

package.json

{
    "name": "rator",
    "scripts": {
        "postinstall": "lerna bootstrap",
        "build": "lerna run build",
        "test": "lerna run test"
    },
    "dependencies": {
        "lerna": "^3.19.0"
    }
}

.npmrc in CI

email = xxx@example.com
registry = https://custom-repo.fr/repository/our-group
always-auth = true
_auth = xxxx

I use the same repository on my machine but it works. I guess it has something to do with the always auth.

But, when run on CI, npm install works normally and then lerna bootstrap, (or lerna exec 'npm i') prints this error on the first package it tries to bootstrap :

17:48:01 npm ERR! code E401
17:48:01 npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

Your Environment

Executable Version
lerna --version 3.19.0
npm --version 6.11.3
node --version 10.16.0
OS Version
Ubuntu 16.10

Questions

I am not really sure it’s something in lerna, my guess is that I may have to configure something differently, like making lerna use the _auth config in my npmrc but I didn’t find anything working for the last day.

I’ll be doing repeated npm installs and publish in the meanwhile 😕

Thanks in advance 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ASnowcommented, Aug 16, 2021

Had same issue. Some workaround is put: //custom-repo.fr/repository/our-group:_auth = xxxx

into npmrc.

node-fetch-registry package don’t get _auth key in some reason. It happend while pacote request manifest method.

0reactions
JamesHenrycommented, Nov 29, 2022

Hi Folks 👋

Please take a look at our published roadmap for Lerna v7 here: https://github.com/lerna/lerna/discussions/3410

One of the key items covered at length on there (please do read it for full context) is that now that we find ourselves in late 2022, it no longer makes sense for lerna to supplement package management concerns (such as installation, boostrapping, linking etc) which are covered reliably for monorepo workspaces by the three main package managers: npm, yarn and pnpm. lerna bootstrap et al were developed in completely different era of the JavaScript ecosystem.

If you have any specific concerns please do join in on that discussion, and provide as much context as possible.

Many thanks 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lerna boostrap fails with npm ERR! code E401 - Stack Overflow
npm i - passes but "npm run bootstrap" fails. I've tried multiple options like. in .npmrc added credentials for my-repo. //my-repo-url:8081 ...
Read more >
basic realm=sonatype nexus repository manager - You.com
npm error E401: Unable to authenticate, need: BASIC realm="Sonatype Nexus ... So we're having trouble with a simple lerna bootstrap when run in...
Read more >
Can't connect to private NPM repository, Error 401 using valid ...
This statement sounds like you're confusing client authentication with Nexus authenticating to the remote repository.
Read more >
How to troubleshoot NPM problems - JFrog
401 : Authentication issue, meaning the user did not use the right username / password ... 404: Resource not found, check repository for...
Read more >
Getting “npm ERR! Unable to authenticate, need: Basic realm ...
In my case, I have set registry via npm config set registry <corporate_registry_url> an authenticated via npm login and I had this 401...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found