I'm new to Node and trying to install TypeScript using the following command:
npm install -g typescript
I get the following error:
if you are behind a proxy, please make sure that the 'proxy' config is set properly.
I have set my proxy using the following commands:
npm config set proxy http://Username:Pa55w0rd#proxyhostname
npm config set https-proxy http://Username:Pa55w0rd#proxyhostname
and tried this also:
npm config set proxy http://"ninjadev:5trongP#ssw0rd"#proxy.some-bigcorp.com
npm config set https-proxy http://"ninjadev:5trongP#ssw0rd"#proxy.some-bigcorp.com
But none of them work. I am working behind a copmpany proxy with authentication, so I think this is stopping me from connecting. I have added my username and password and this also didn't work.
Does anyone have any idea how I can connect to npm whilst using the company proxy and authentication?
Thanks
Did you try with
npm config set proxy http://"ninjadev:5trongP#ssw0rd"#proxy.some-bigcorp.com:PORT
npm config set https-proxy http://"ninjadev:5trongP#ssw0rd"#proxy.some-bigcorp.com:PORT
where PORT can be 8080 if you don't have the proxy port?
This worked for me:
npm config set https-proxy "ninjadev:5trongP#ssw0rd"#proxy.some-bigcorp.com:PORT
Whithout http/https before.
The following code worked for me:
npm config set proxy "http://"username:password"#proxy.big-corp.com"
This thing worked for me:
npm config set proxy http://"ninjadev:5trongP#ssw0rd"#proxy.some-bigcorp.com:PORT
Open cmd as an administrator and past the command there. Modify the command with credentials provided for your user.
In ubuntu-18.04 make sure that in home directory .npmrc file contains:
proxy=http://username:password#proxyhostname:port
https-proxy=http://username:password#proxyhostname:port
Related
Hello everyone I´ve been trying to configure and use npm on my enterprise PC without success.
I´ve set proxy, https-proxy, strict-ssl false, registry http://registry.npmjs.org
proxy has been set like this "http://user:password#proxy_ip:proxy:port"
Where the password has a special character written in urlencode.
npm config get proxy
returns proxy with credentials as they should be.
I have cleared my npm cache and tried again.
No success.
Any ideas what can be the problem?
I recommend reading through this article to configure the proxy for npm.
http://wil.boayue.com/blog/2013/06/14/using-npm-behind-a-proxy/
npm config set proxy http://proxy.company.com:proxyport
npm config set http-proxy http://proxy.company.com:proxyport
npm config set https-proxy http://proxy.company.com:proxyport
Hope this is useful for you!
Usually, when you are behind a corporate proxy, it is needed to add the domain where you are at. Given that also the characters should be URL encoded, it would look like:
https://domain%5Cusername:password#proxy:port
We should add proxy with username and password to avoid this error.
For example:
username: admin
password: admin123
proxy: 172.10.3.21
port: 3128
npm config set proxy http://admin:admin123#172.10.3.21:3128
npm config set https-proxy http://admin:admin123#172.10.3.21:3128
Editing the .npmrc file in user folder worked for me.
I set the proxy and npm registry as follows:
proxy=http://username:password#proxy:port/
https-proxy=http://username:password#proxy:port
registry=http://registry.npmjs.org/
Note : for usenames and passwords containing special charcters, the characters need to be encoded in the proxy configuration.
e.g if username is "user" and password is "1234#user", then the .npmrc file will look like :
proxy=http://user:1234%40user#proxy:port/
https-proxy=http://user:1234#user#proxy:port
registry=http://registry.npmjs.org/
where, %40 is the encoded form of "#".
In my case, the pound symbol(#) was not getting accepted in username or password(Dont know why).
if you use windows and cntlm and you get a 407 error from cntlm proxy server, make sure that your PassNTLMv2 in the cntlm.ini is up-to-date, as you have to recreate it, everytime that you change domain password.
I had this error on my corporate machine and this command in Terminal fixed it:
proxyOn () {
export PROXY_CREDS=http://localhost:9000
export ALL_PROXY=${PROXY_CREDS}
export https_proxy=${PROXY_CREDS}
export http_proxy=${PROXY_CREDS}
export HTTP_PROXY=${PROXY_CREDS}
export HTTPS_PROXY=${PROXY_CREDS}
}
The character dot . , dont work on http request but . remplace it
Before
npm config set proxy http://name.surname:pwrd#host:port
After
npm config set proxy http://name.surname:pwrd#host:port
As others mention above you should set both the proxy and https-proxy configuration variables. as below:
https-proxy=http://userName:password#urlOfYourProxy:8080/
What no mentions is that the https-proxy variable should point to a proxy url that uses the http protocol NOT the https protocol (as shown above)!! Pretty darned counter intuitive.
When I try to run the following command npm i baconjs#0.7.88 -save behind the proxy i get the ERR! code ETIMEDOUT error.
I have been getting this error when I am not logged on to the VPN. Now I have attempted all methods. Setting and Unsetting the proxies numerous times. Logging on and off the VPN with the proxies set/unset. no luck.
One thing I have noticed though is when I set the proxies and I have not logged on the vpn I get that error above (ERR! code ETIMEDOUT) but when I log on to the VPN and run the command I get a different error this time which is:
npm ERR! code EMAXREDIRECT
npm ERR! maximum redirect reached at: https:// registry.npmjs.org/registry.npmjs.org:
What do I need to do to get npm to successfully complete this command
npm i baconjs#0.7.88 -save. So frustrating this is, been at it for a couple of hours and I feel like putting this thing in the bin but I don't own it.
Different proxy methods I have tried
npm config set proxy http: //username:password#companyvpn.xx.xx:
npm config set https-proxy http: //username:password#companyvpn.xx.xx:
npm config set proxy http:// username:password#companyvpn.xx.xx
npm config set https-proxy http:// username:password#companyvpn.xx.xx
npm config set proxy http:// companyvpn.xx.xx
npm config set https-proxy http:// companyvpn.xx.xx
you would expect the first set of config to work but NO.Eventually I ran out of ideas
I tried with
npm config set https-proxy http://proxy:8080
It worked for me
Eventually I resorted to doing the install manually (downloading from github). It turns out that the problem had nothing to do with the npm config.
To fix this, the machine had some Enviroment Variables that are confingured for HTTP and HTTPS_PROXY. Before I was configuring these to match those of the npm config but no success.
What I did was delete these variables, they can be accessed via settings "Edit environment variables for your account". On windows > "Type here to search" located bottom left next to windows menu.
I deleted these variables and deleted the npm proxy config settings as well and then logged on to the company vpn, run npm and it was successful.
Behind the vpn proxy, I now only need to config npm with the company vpn and port number like so:
npm config set proxy http:// companyvpn.xx.xx:portNumber
npm config set https-proxy http:// companyvpn.xx.xx:portNumber
Some companies require adding username and password, some don't
I am completely new to set up NPM. I have executed the following commands. My password has special characters like # : #. However I am not able to set the proxy. Is my password creating a problem?
npm config set https-proxy "http://username:password#<servername>:<port>/"
npm config set http-proxy "http://username:password#:<servername>:<port>"
npm config set strict-ssl false
Can some one help me.
Try with a string jsut around your username and password and/or without http/https (and try you solution with your https proxy with and s too)
npm config set https-proxy "username:password"#proxy.corp.com:PORT
I am trying to install bower
npm install -g bower
but am getting an authentication error from our proxy
...
npm http 407 http://registry.npmjs.org/bower
...
Error Code: 407 Proxy Authentication Required.
...
I am trying to get npm working behind a corprate proxy. I think our proxy is a little weird because the only way I was able to get maven downloading packages was to add wagon-http-lightweight.jar as a maven extension.
http://maven.apache.org/wagon/wagon-providers/wagon-http-lightweight/
I have tried all the regular things as described here:
Is there a way to make npm install (the command) to work behind proxy?
(I don't need to supply authentication details in my maven proxy settings).
npm config set registry http://registry.npmjs.org/
npm config set proxy http://myusername:mypassword#proxy.us.somecompany:8080
npm config set https-proxy http://myusername:mypassword#proxy.us.somecompany:8080
npm config set strict-ssl false
What else can I try?
Can try this....working for me.
Open IE (Chrome did not work for me).
Hit the URL http://registry.npmjs.org
it will download json output if successful.
Now go back to command prompt and try npm install.
I was able to get this working by installing a local proxy:
NPM behind NTLM proxy
Use fiddler http://www.telerik.com/fiddler
Install and run and that's it, everything will run as it is supposed to. I spent half a day cracking my head on this
Edit: I honestly have no idea if it was fiddler or something else I tried that fixed it (it is mostly the latter) but you should try setting registry, http-proxy, proxy and strict-ssl
When authentication is required for the HTTP proxy:
Fiddler can be configured to authenticate with the corporate HTTP proxy using NTLM or other protocols. Leave the existing auto authenticate options/rules defaults in place. Instead, go to this setting from the menu bar:
Tools > Telerik Fiddler Options > Connections tab
Click on the Allow remote computers to connect checkbox. You will see a dialog explaining the consequences of enabling this option. Restart Fiddler and update the .npmrc file as shown above. Whenever you need npm to access the registry site just run Fiddler. This setting won't affect the way Fiddler runs for other captures.
I have the same issue.
The root cause is my password contains a special character '#', when I npm set config proxy, the character become '#' in .npmrc file, so I change my password to remove the special character and it's working fine.
If your password does not contains special characters, just use syntax command below, it will work.
npm config set strict-ssl=false
npm config set proxy http://<username>:<password>#<proxy-server-url>:<port>
npm config set https-proxy http://<username>:<password>#<proxy-server-url>:<port>
Thanks,
I am getting Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND while trying to install a module in node.js. It seems some proxy error.I checked in browser setting ,proxy is disabled. But when i am checking in command prompt npm config get proxy, getting 192.168.98.5:8080. How to disable this?
First, try to execute npm config delete proxy. If you get something like Error: ENOENT, unlink '/Users/drlazor/.npmrc' is OK; that means you don't have a npm config file and, therefore, no proxy settings.
Second, verify you have no proxy settings with npm config get proxy. You should get a nullor the above error. If you keep on getting a result different from null, you should also ensure you haven't set the environment variable HTTP_PROXY.
Third and last, if none of those worked, try accessing the URL from your browser; it could be a network issue after all.
You should check the npm config page on how to set and modify config values. proxy key stores proxy server to use to connect to npm repositories. Try this :
npm config delete proxy
Note: This Works if you are not behind a Proxy i.e (From a Personal Computer)
First execute this command
npm config edit
npm the configuration file opens
comment following two lines in the opened file by putting ";"(semi Colon) in start of the line.
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
You are done.
Now install any package you want to.
npm install -g cordova
npm install -g npm
or anything else you need to install
i was in the same state and got this error because of the wrong proxy value format
(i just miss "http://" at the beginning of the proxies values).
If a proxy should be set, here is the format (values depend of your network) :
npm config set proxy http://proxy.mydomain:3128
npm config set https-proxy http://proxy.mydomain:3128
This can also happen if your NPM is configured to use a different NPM registry server (possibly you are on a work machine and not connected to the network/VPN). To see if this is the case:
npm config edit
and look for:
registry=http://alternateurl
The default is:
https://registry.npmjs.org/
You can connect to your VPN/network or change that config to correct.
You need to set all 3 proxy
npm config set proxy http://proxy.name.xx:port
npm config set http-proxy http://proxy.name.xx:port
npm config set https-proxy http://proxy.name.xx:port
If you have no proxy use the following commands:
npm config delete https-proxy
npm config delete proxy
if you are using a proxy use:
npm config set proxy $PROXY
npm config set http-proxy $PROXY
Either of the two tend to work
In case setting proxy via terminal or creating .npmrc does not help, try to put .typingsrc file in c:\Users\'username' with the following content
{
"proxy": "http://proxy.name.xx:port",
"https-proxy": "http://proxy.name.xx:port",
"strict-ssl": false
}