3

I am using Sonatype nexus as my repository where I have configured npm to have public and private repositories.

  • npm-public -> proxy for npm registry.
  • npm-private -> private repository to publish company related repositories.
  • npm-group -> group having access to above two repositories.

my .npmrc file has config

registry=<<private_repo_url>>/npm-group/
_auth=<<token>>
strict-ssl=false
always-auth=true

I get the following error when I install my private package on my local machine

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

npm ERR! A complete log of this run can be found in:

Although I can publish my private packages to <<private_repo_url>>/npm-internal/

I am on windows laptop using git bash. Sonatype Nexus version: 3.15.2 nodejs: v12.21.0 npm: 6.14.11

Any help would be appreciated.

Ashwin Kumar
  • 49
  • 1
  • 3
  • make sure that your token is correct , your .npmrc file is in the correct location by using npm config ls -l , and npm Bearer Token Realm is active in your nexus configuration realms – biiyamn Mar 28 '21 at 17:52

1 Answers1

4

Try to add npm Bearer Token Realm to your security configuration

enter image description here

Prebiusta
  • 477
  • 3
  • 14