I am trying to use npm to install a package from url : http://host:80
I did the following: npm config set strict-ssl false npm config set registry "<>" npm --proxy http://host:port install <> (our proxy does not require authentication)
When I tired to run above install package command it throws npm ERR! code E401 npm ERR! 401 Authorization Required: @latest
When I should I set the username and pwd for registry url.I googled and found that registry url and details are part of .npmrc file.
Currently it has
strict-ssl=false
registry=<>enter code here
Should I add username and password here in this file ? If so can you give me the format or how to add it or where to add it.Thank you.
You can set separate profile(s) for the secondary registry, in your case
http://host:80
usingnpmrc
tool.First install
npmrc
globally on your machine with:Make sure installation went fine, by listing all available profiles:
It should show your
default
profile.Add a separate profile, so you can customise your registry hostname, with:
where
work
can be any preferable name for your profile.Select it with:
Then add your specific hostname with:
Finally add user with credentials and email, using:
It will prompt you for all needed data.
To switch back to default profile (with default npm registry), you can use: