Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install npm packages from Sonatype Nexus private repository

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.

like image 779
Ashwin Kumar Avatar asked Nov 30 '25 20:11

Ashwin Kumar


1 Answers

Try to add npm Bearer Token Realm to your security configuration

enter image description here

like image 51
Prebiusta Avatar answered Dec 03 '25 15:12

Prebiusta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!