I upgraded node version to 12.16.2 and npm version to 6.14.4. After that I am not able to run npm install
, as I'm getting this error
code E401
npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"
I even tried deleting node_modules and package-lock.json and running npm install again, but doesn't change anything.
I had similar issue. I resolved it by adding _auth
into my ~/.npmrc
. See the doc how to encode your nexus credential. I added the encoded credential using npm config set _auth xxx
.
You wont be able to see the value using npm config list
or npm config get _auth
.
what worked for me is :
I deleted the .npmrc file under C/users/ folder. and ran npx vsts-npm-auth -config .npmrc command to create a new file in the users folder
In my case, the problem was I've entered another registry address in same Nexus for npm login
command.
npm login --registry=http://nexus_url:port/repository/wrong_address
My problem was solved by logging into correct address:
npm login --registry=http://nexus_url:port/repository/correct_address
I found a way out. With this new npm version they are enforcing authentication to access certain packages. We realised we don't need to use authentication for any of the packages we were downloading, hence the auth code we had was unnecessary. So we just removed it and it all worked.
vsts-npm-auth -config .npmrc -F
Is the only solution I found;
Edit: make sure to run npm install -g vsts-npm-auth
before
I encountered this error when running an npm install
that was pulling some dependencies from a non-public registry located on a self-hosted Azure DevOps (AzDo) server.
I had a .npmrc
file in the project, and a .npmrc
file in my user profile dir with an AzDo personal access token (PAT) that had allowed access previously. The AzDo UI reported my token as still being valid.
PS C:\src\app> npm install
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="{INTERNAL_REGISTRY_URL}", Negotiate, NTLM
.npmrc
found in my user profile directory.What worked for me was running npm login
, then entering my Username, Password, and Email to log in to the registry defined in .npmrc
. I then proceeded with npm installing the packages I needed and it worked.
I'm run set's command from the post and add in nexus "Active realms" profile "npm Bearer Token Realm". Links: https://help.sonatype.com/repomanager3/system-configuration/access-control/realms My problem was solved.
In my case the Nexus Authentication and project I am using requires Node version: 12.8.1.
I was using node version: 16.13.2
I use NVM to install 12.8.1 with nvm install 12.8.1
Then nvm use 12.8.1
This will now work on my machine and environment.
You can remove package-lock.json .. it works with me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With