I'm facing this error when I'm trying to install Angular CLI. Please help me with the issue:
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="Artifactory Realm"
I'm facing this error when I'm trying to install Angular CLI. Please help me with the issue:
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="Artifactory 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 error until I've added to .npmrc config file this line
//<repo_url>:always-auth=true
after the following line
//<repo_url>:_authToken=<token>
This way, token got applied and installation of a package succeeded.
I was trying to setup npm for the first time on my laptop. My corporate npm registry is in Artifactory. I had configured my auth through the .npmrc file by adding the below details to it (as suggested in Artifactory "set me up"):
_auth=xxxxxxxxxxxx
always-auth=true
email=xxxxxx@xxxx.com
The error (npm ERR! Unable to authenticate, need: Basic realm="Artifactory Realm") got resolved after removing underscore (_) from auth in the .npmrc file:
auth=xxxxxxxxxxxx
always-auth=true
email=xxxxxx@xxxx.com
Looks like you're running into authentication issues with your company's internal npm registry. I'd try one of these solutions:
--registry https://registry.npmjs.org to your npm commands in the short term. This will install from the public registry, which you should not need to authenticate to.If you run npm config ls, you will likely see a registry line. There should be a filename above it ending in .npmrc; if you edit this file you can change the registry to the public one. (Usually it's ~/.npmrc but may depend on your configuration.)
Adding following in .npmrc worked for me:
_auth = <Basic_Authentication_Header>
email = myemail@email.com
always-auth = true
Online utility which can help to generate Basic Authentication Header can be found here - https://www.blitter.se/utils/basic-authentication-header-generator/
What worked for me:
npm config ls
Look for the location/path of where .npmrc - next to text: userconfig
Go to that location/path then delete the .nprmc file
Ran the in npm install command - e.g:
npm install cypress --save-dev
It helps if you post your NPM configs. Use npm config ls to see what registry you have set up. I ran into a similar error message and my solution was to set the registry as secured HTTP: registry=https://.... I'm also using my job's Artifactory server. Once you set the registry, you can try authenticating against the Artifactory registry using npm login, which will prompt you for username, password, and the e-mail address associated with your Artifactory registry account.
This Artifactory endpoint will retrieve an encrypted auth token (which can be used for reaching the Artifactory API) and e-mail:
curl -vv -<username>:<encrypted-password> http://<ARTIFACTORY-HOST</artifactory/api/npm/auth
You can get <encrypted-password> usually by going to your Artifactory account in the browser at https://<artifactory-host>/artifactory/webapp/#/profile.
Sample output:
_auth = <encrypted-auth-token>
always-auth = true
email = joe.smith@somehost.com
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
I ran into this issue because we recently integrated AWS CodeArtifact into our platform, and I forgot to run
aws codeartifact login --tool npm --domain {MY_DOMAIN} --domain-owner {MY_AWS_ACCOUNT} --repository {MY_REPOSITORY}
Which will overwrite your .npmrc file with proper authentication
vsts-npm-auth -config .npmrc -F
Is the only solution I found
Make sure to run npm install -g vsts-npm-auth before
I faced this error. the issue was the Password, I used '$' sign and made this error, I used another symbol and my problem was solved.