set http_proxy worked really well for me but I had to enter it in every time I opened the command prompt. So I had to combine multiple answers and now mine is permanent.
My sequence went as follows:
- Go to
- Create a file named
- Inside that file type the following (if you are on an AD domain):
proxy = http://domain\\username:[email protected]:port
- Or use this is you are NOT on an AD domain:
proxy = http://username:[email protected]:port
- Save the File
- Open a command prompt and try to use
Others have had extra success with the following extra command:
strict-ssl = false
*You should be able to use an IP address or the URL to the proxy in place of “IP” above.
Your proxy string may need to be tweaked a bit, but this made it so that I didn’t have to add this every single time.
Maybe setting an environment variable will work for you:
set HTTP_PROXY=http://user:[email protected]:port
(In my case, this solves the “connect UNKNOWN”, but I get a completely different “socket hang up” error. I also tried setting the HTTPS_PROXY environment variable, but got the same result.)
I had this identical issue and here’s what I did to make this work:
- Go to:
- Create a file named
And it’s entry will read:
registry = http://registry.npmjs.org
Try the command
node cli.js install npm -gfagain.
After some research, I could use it in this way:
Install NTLM Authorization Proxy Server or another proxy server for NTLM, like Cntlm. Personally, I prefer the python server, because I can tinker with it, and performance is not a problem.
Set up the configuration; note that in my case, I had to enable both LM and NT mode, and I would suspect it being the normal case, nowadays.
Set http_proxy and https_proxy environment variable to point to your local proxy:
npm should work now, of course it should be executed from a shell where the above environment variables are defined.
The following worked for me.
On Windows 7:
npm config set proxy xxhttp://username:[email protected]:port#
This should create a file named
.npmrc in the
Each one of the above answers needs the user to write her password in a text file, or in an environ ment variable.
Personally I didn’t like a solution like these, for their insecure approach. So I tried to write an application which injects the Kerberos token of the current user in the exchanges between the client (npm, bower, git) and the proxy. That said, Active Directory is just a proprietary implementation of Kerberos.
I use this software everyday, on a Windows 8.1 host. You can find the code (golang) and the first release binaries on https://github.com/nilleb/authentication-proxy.
This issue resolved for me after creating the .npmrc file as above, and then running the adduser command and following cmd prompts.
Run the following comman to see if you have an authorised username:
At least in Windows, it works for me with the following setting:
i.e., (1) use
%5C instead of
\ (as suggested elsewhere) and (2) use the IP address instead of the local machine name for the proxy server.
You will get the proxy host and port from your server administrator or support.
After that set up
npm config set http_proxy http://username:[email protected]:itsport npm config set proxy http://username:[email protected]:itsport
If there any special character in password try with % urlencode. Eg:- pound(hash) shuold be replaced by %23.
The solution worked for me is the following:
npm config set http_proxy http://username:password@host/IP:port
npm config set proxy http://username:password@host/IP:port
replace the parameters with the values, in my case
host/IP : 22.214.171.124
port : 8080
so My commands are
npm config set http_proxy http://:@126.96.36.199:8080
npm config set proxy http://:@188.8.131.52:8080
CNTLM didn’t work for me. I tried all possible combinations. NPM was giving Authentication error. Fiddler came for rescue and saved my time. It is easy to install and configure. Set Fiddler Rule to Automatically Authenticated.In .npmrc set these
registry=http://registry.npmjs.org proxy=http://127.0.0.1:8888 https-proxy=http://127.0.0.1:8888 http-proxy=http://127.0.0.1:8888 strict-ssl=false
It worked for me 🙂
What worked for me was as follows:
registry=http://registry.npmjs.org proxy=http://<url.pac> https-proxy=http://<url.pac> http-proxy=http://<url.pac> strict-ssl=false
I did not have to enter any usernames or passwords, simply the PAC file url.