Read about a proxy variable in a .npmrc
file but it does not work. Trying to avoid manually downloading all require packages and installing.
Use below command at cmd or GIT Bash or other prompt
$ npm config set proxy "http://192.168.1.101:4128"
$ npm config set https-proxy "http://192.168.1.101:4128"
where 192.168.1.101 is proxy ip and 4128 is port. change according to your proxy settings. its works for me.
Though there are already many good advice, for my environment(Windows 7, using PowerShell) and the last version available of node.js ( v8.1.2 ) all the above did not worked, except when I followed brunowego settings.
So check your settings with :
npm config list
Settings behind a proxy:
npm config set registry http://registry.npmjs.org/
npm config set http-proxy http://username:password@ip:port
npm config set https-proxy http://username:password@ip:port
npm config set proxy http://username:password@ip:port
npm set strict-ssl false
Hope this will save time to someone
npm config set proxy <http://...>:<port_number>
npm config set registry http://registry.npmjs.org/
This solved my problem.
This worked for me. Set the http and https proxy.
My issue came down to a silly mistake on my part. As I had quickly one day dropped my proxies into a windows *.bat file (http_proxy, https_proxy, and ftp_proxy), I forgot to escape the special characters for the url-encoded domain\user (%5C) and password having the question mark '?' (%3F). That is to say, once you have the encoded command, don't forget to escape the '%' in the bat file command.
I changed
set http_proxy=http://domain%5Cuser:password%3F@myproxy:8080
to
set http_proxy=http://domain%%5Cuser:password%%3F@myproxy:8080
Maybe it's an edge case but hopefully it helps someone.