Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS NPM Proxy error when installing grunt

Tags:

When I'm trying to install grunt via npm, I'm getting a following error:

C:\Program Files\nodejs\node_modules\npm>npm install -g grunt
npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "grunt"
npm ERR! cwd C:\Program Files\nodejs\node_modules\npm
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! syscall connect
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Program Files\nodejs\node_modules\npm\npm-debug.log
npm ERR! not ok code 0

I´m using enterprise proxy configurations, and I believe that I'm having this error because of its configurations. What do I need to change in order to install grunt successfully?

like image 856
Anton Selin Avatar asked Nov 18 '14 08:11

Anton Selin


People also ask

How do I fix a proxy error in node JS?

Proxy error: Could not proxy request from localhost:3000 to http://localhost:8000/. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ETIMEDOUT). To resolve this, one has to add “secure: false” in package. json defined in ReactJS and restart again.

How do I remove HTTP proxy from npm config?

By running npm config rm proxy you remove proxy from user configuration. This can be easily verified by running: npm config list. If there is proxy or https-proxy setting set in global config you have to use --global in the command to remove it.


1 Answers

You need to configure the npm config file, this can be done in the terminal:

npm config set proxy http://proxy.company.com:8080

npm config set https-proxy http://proxy.company.com:8080

Your error log suggests to see 'npm help config', so i think the problem comes from there.

If you want a link with more explanation see this blog entry (there are plenty more)

Good luck!

like image 145
Kangcor Avatar answered Sep 28 '22 23:09

Kangcor