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 401 error when publishing to a private repo

See original GitHub issue

Expected Behavior

Runing using Jenkins :

lerna publish --yes --canary minor

Should publish my packages to the provided private registry.

Current Behavior

Throws error:

18:55:35 lerna notice Skipping all user and access validation due to third-party registry
18:55:35 lerna notice Make sure you're authenticated properly ¯\_(ツ)_/¯
18:55:35 lerna http fetch PUT 401  85ms
18:55:35 lerna ERR! E401 Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

Possible Solution

I tried :

1/ in lerna.json

  "command": {
    "publish": {
      "npmClient": "npm",
      "verifyAccess": false,
      "ignoreChanges": []
    }
  }

2/ --no-verify-access

3/ add .npmrc (it is ignored).

Your Environment

Executable Version
lerna --version 3.19.0
npm --version 6.4.1
node --version 10.14.1

Any help please ?

How can I setup authentication using lerna ?

Is there equivalent to npm options --globalconfig ${pp.env.GLOBAL_NPM_CONFIG} --color=always and --userconfig ${pp.env.NPM_CONFIG} using lerna ?

thanks 😃

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:28

github_iconTop GitHub Comments

5reactions
lookmanrayscommented, Jul 8, 2021

Additional info for researchers. In a case when multiple packages are publishing from GitHub Actions, the YAML should provide env variables with tokens. I found a good example. With the 401 error, these lines helped me (from the example).

Many thanks to the repo author and to the authors of this thread 🙏🏻

5reactions
nifaniccommented, Feb 8, 2020

@helabenkhalfallah, try this official GitHub guidelines.

My problem was caused by—

  1. local .npmrc, where I specified custom registry URL without my GitHub name, and
  2. Lerna package package.json files missed repository field. E.g., github:<your-github-name>/<your-repo>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot publish to github package registry from travis
Everything seems to work fine (build and tests succeed), but when it tries to publish, I'm getting a 401 error. I've added my...
Read more >
basic realm="sonatype nexus repository manager"
npm error E401: Unable to authenticate, need: BASIC realm="Sonatype Nexus ... Authentication error on publishing to private NPM repository on Nexus.
Read more >
Creating and publishing your first GitHub private package ...
I will use my monorepo-test private git repository, and private ... Lerna publish throws 401 error if both doesn't match with no error...
Read more >
NPM Publish returns error 400 - GitLab Forum
I created a test repo to try publishing private NPM packages. I wanted to try it with Lerna first, that's why the project...
Read more >
How to troubleshoot NPM problems
How to troubleshoot NPM problems ; 401: Authentication issue, meaning the user did not use the right username / password ; 403: Authorization...
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