Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not able to install node_modules

Tags:

node.js

npm

I am trying to install node_module but getting following error:

For example:npm install grunt-preprocess

D:\grunt_pre>npm install grunt-preprocess
 npm http GET https://registry.npmjs.org/grunt-preprocess
 npm http GET https://registry.npmjs.org/grunt-preprocess
 npm http GET https://registry.npmjs.org/grunt-preprocess
 npm ERR! Error: connect ETIMEDOUT
 npm ERR!     at errnoException (net.js:901:11)
 npm ERR!     at Object.afterConnect [as oncomplete] (net.js:892:19)
 npm ERR! If you need help, you may report this log at:
 npm ERR!     <http://github.com/isaacs/npm/issues>
 npm ERR! or email it to:
 npm ERR!     <[email protected]>

 npm ERR! System Windows_NT 6.1.7601
 npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
 ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "grunt-preprocess"
 npm ERR! cwd D:\grunt_pre
 npm ERR! node -v v0.10.15
 npm ERR! npm -v 1.3.5
 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!     D:\grunt_pre\npm-debug.log
 npm ERR! not ok code 0
like image 754
amolp1709 Avatar asked Aug 14 '13 10:08

amolp1709


2 Answers

The registry URL is pointing to https, you could try changing it by

npm config set registry="http://registry.npmjs.org/"

and then try installing the module. It may be possible that you are behind a proxy that is blocking secure (https) connections

If it doesn't work then may be you could manually try to download the current version of the module you are trying to install from the here

And run the command npm install grunt-preprocess-2.3.0.tgz

like image 95
Salman Avatar answered Oct 15 '22 06:10

Salman


I also had ETIMEDOUT errors and was able to resolve the issue by disabling my router's firewall, rebooting it, and most importantly, configuring the number of simultaneous connections with the following npm command:

npm set maxsockets 3

This sets a max number of connections of 3, instead of the default 50. The CLI has been allowing this option since [email protected]. See this link for further reference.

like image 4
Erwin Mayer Avatar answered Oct 15 '22 05:10

Erwin Mayer