network connect ETIMEDOUT for Protractor instalaltion in a VM - node.js

Background_Note:
I have installed protractor successfully in all global/host machines. But the same does't work in VMs.
That is, this issue appears only in a Windows 7 Virtual machine, not otherwise.
All these machines (VM, hosts and individual machines) have the same Proxy settings, and I have set the same in npm config everywhere.
npm config set proxy http://proxy_server:8080
npm config set https-proxy http://proxy_server:8080
Now the procedure I tried:
I am in a windows 7 remote desktop (VM), logged in as a non administrator user
I opened cmd window as administrator.
Tried installing protractor as
npm install -g protractor
This installation fails, log and config lists are attached below.
Tried all the possible answers from Bower error tunneling socket could not be established, cause=Parse Error
==> They don't work for me.
C:\Windows\system32>npm config list
; cli configs
registry = "http://registry.npmjs.org/"
user-agent = "npm/1.4.28 node/v0.10.33 win32 x64"
; userconfig C:\Users\test\.npmrc
registry = "http://registry.npmjs.org/"
; builtin config undefined
prefix = "C:\\Users\\test\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\\node.exe
; cwd = C:\Windows\system32
; HOME = C:\Users\test
; 'npm config ls -l' to show all defaults.
C:\Windows\system32>
Log written at npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'protractor',
1 verbose cli '--registry',
1 verbose cli 'http://registry.npmjs.org/' ]
2 info using npm#1.4.28
3 info using node#v0.10.33
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose cache add [ 'protractor', null ]
6 verbose cache add name=undefined spec="protractor" args=["protractor",null]
7 verbose parsed url { protocol: null,
7 verbose parsed url slashes: null,
7 verbose parsed url auth: null,
7 verbose parsed url host: null,
7 verbose parsed url port: null,
7 verbose parsed url hostname: null,
7 verbose parsed url hash: null,
7 verbose parsed url search: null,
7 verbose parsed url query: null,
7 verbose parsed url pathname: 'protractor',
7 verbose parsed url path: 'protractor',
7 verbose parsed url href: 'protractor' }
8 silly lockFile 4f4f4858-protractor protractor
9 verbose lock protractor C:\Users\test\AppData\Roaming\npm-cache\4f4f4858-protractor.lock
10 silly lockFile 4f4f4858-protractor protractor
11 silly lockFile 4f4f4858-protractor protractor
12 verbose addNamed [ 'protractor', '' ]
13 verbose addNamed [ null, '*' ]
14 silly lockFile 80d5ca5a-protractor protractor#
15 verbose lock protractor# C:\Users\test\AppData\Roaming\npm-cache\80d5ca5a-protractor.lock
16 silly addNameRange { name: 'protractor', range: '*', hasData: false }
17 verbose request where is /protractor
18 verbose request registry http://registry.npmjs.org/
19 verbose request id b468ffda57abdf0d
20 verbose url raw /protractor
21 verbose url resolving [ 'http://registry.npmjs.org/', './protractor' ]
22 verbose url resolved http://registry.npmjs.org/protractor
23 verbose request where is http://registry.npmjs.org/protractor
24 info trying registry request attempt 1 at 18:20:15
25 http GET http://registry.npmjs.org/protractor
26 info retry will retry, error on last attempt: Error: connect ETIMEDOUT
27 info trying registry request attempt 2 at 18:20:47
28 http GET http://registry.npmjs.org/protractor
29 info retry will retry, error on last attempt: Error: connect ETIMEDOUT
30 info trying registry request attempt 3 at 18:22:08
31 http GET http://registry.npmjs.org/protractor
32 silly lockFile 80d5ca5a-protractor protractor#
33 silly lockFile 80d5ca5a-protractor protractor#
34 error network connect ETIMEDOUT
34 error network This is most likely not a problem with npm itself
34 error network and is related to network connectivity.
34 error network In most cases you are behind a proxy or have bad network settings.
34 error network
34 error network If you are behind a proxy, please make sure that the
34 error network 'proxy' config is set properly. See: 'npm help config'
35 error System Windows_NT 6.1.7600
36 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "protractor" "--registry" "http://registry.npmjs.org/"
37 error cwd C:\Windows\system32
38 error node -v v0.10.33
39 error npm -v 1.4.28
40 error syscall connect
41 error code ETIMEDOUT
42 error errno ETIMEDOUT
43 verbose exit [ 1, true ]

Solved.
When a VM is used and it has certain set of proxies, use the global proxy (which is the root for all others).
So, run these two commands before installing protractor:
C:\Windows\system32>npm config set registry "http://registry.npmjs.org/"
C:\Windows\system32>npm config set proxy http://global.proxy.alcatel-lucent.com:8000
Solves the issue

Related

How do you install packages with npm?

I have never used nodejs before. I just found out about the npm. If you wanted to install a package using npm, will you have to download the file first? If so, where do you put the file? would you place it in the same folder as the npm?
I tried to install faye with npm and this is what I got on the npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'faye' ]
2 info using npm#2.7.4
3 info using node#v0.12.2
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 silly cache add args [ 'faye', null ]
6 verbose cache add spec faye
7 silly cache add parsed spec { raw: 'faye',
7 silly cache add scope: null,
7 silly cache add name: 'faye',
7 silly cache add rawSpec: '',
7 silly cache add spec: '*',
7 silly cache add type: 'range' }
8 verbose addNamed faye#*
9 silly addNamed semver.valid null
10 silly addNamed semver.validRange *
11 silly addNameRange { name: 'faye', range: '*', hasData: false }
12 silly mapToRegistry name faye
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/faye
16 verbose addNameRange registry:https://registry.npmjs.org/faye not in flight; fetching
17 verbose request uri https://registry.npmjs.org/faye
18 verbose request no auth needed
19 info attempt registry request try #1 at 7:19:45 PM
20 verbose request id e2cc452cb2788a4b
21 http request GET https://registry.npmjs.org/faye
22 info retry will retry, error on last attempt: Error: connect EACCES
23 info attempt registry request try #2 at 7:19:55 PM
24 http request GET https://registry.npmjs.org/faye
25 info retry will retry, error on last attempt: Error: connect EACCES
26 info attempt registry request try #3 at 7:20:55 PM
27 http request GET https://registry.npmjs.org/faye
28 verbose stack Error: connect EACCES
28 verbose stack at exports._errnoException (util.js:746:11)
28 verbose stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1000:19)
29 verbose cwd C:\tito3
30 error Windows_NT 6.1.7601
31 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "faye"
32 error node v0.12.2
33 error npm v2.7.4
34 error code EACCES
35 error errno EACCES
36 error syscall connect
37 error Error: connect EACCES
37 error at exports._errnoException (util.js:746:11)
37 error at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1000:19)
37 error { [Error: connect EACCES] code: 'EACCES', errno: 'EACCES', syscall: 'connect' }
38 error Please try running this command again as root/Administrator.
39 verbose exit [ 1, true ]
Npm will download the relevant files for the module for you.
There are 2 modes of installing node modules using npm, either locally or globally. Locally (the default) means the modules are downloaded to a node_modules directory at the location you ran the command, so you would normally run this at the root of your app project. Globally (-g option) means it is downloaded to a location so it can be used by anything on your system I.e grunt_cli
The program files directory on windows is protected so you will need to run the command as an administrator, or run npm install from a non protect path such as c:\myapp
You might want to look at a package.json file, this is a file that allows you to list all your modules that you need for your app. Running just npm install in a location that contains a package.json will cause npm to read the file and download all your dependent modules for you.

ERR! network. Cannot install the latest version of npm, yeoman, bower and grunt

I've a problem with the installation for yeoman, bower, grunt and the latest npm version.
The latest version of NodeJS (0.12.2) is installed on my pc.
I have the npm version 2.7.4 but when I start the git bash in the nodejs folder and type "npm install npm" or "npm install npm#latest" then it gives an error message:
error Windows_NT 6.1.7601
error argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "npm#latest"
error node v0.12.2
error npm v2.7.4
error code ETIMEDOUT
error errno ETIMEDOUT
error syscall connect
error network connect ETIMEDOUT
error network This is most likely not a problem with npm itself
error network and is related to network connectivity.
error network In most cases you are behind a proxy or have bad network settings.
error network
error network If you are behind a proxy, please make sure that the
error network 'proxy' config is set properly. See: 'npm help config'
verbose exit [ 1, true ]
And the complete debug log:
0 info it worked if it ends with ok
1 verbose cli [ 'c:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'npm#latest' ]
2 info using npm#2.7.4
3 info using node#v0.12.2
4 warn package.json nodejs#0.12.2 No description
5 warn package.json nodejs#0.12.2 No repository field.
6 warn package.json nodejs#0.12.2 No README data
7 silly cache add args [ 'npm#latest', null ]
8 verbose cache add spec npm#latest
9 silly cache add parsed spec { raw: 'npm#latest',
9 silly cache add scope: null,
9 silly cache add name: 'npm',
9 silly cache add rawSpec: 'latest',
9 silly cache add spec: 'latest',
9 silly cache add type: 'tag' }
10 verbose addNamed npm#latest
11 silly addNamed semver.valid null
12 silly addNamed semver.validRange null
13 info addNameTag [ 'npm', 'latest' ]
14 silly mapToRegistry name npm
15 silly mapToRegistry using default registry
16 silly mapToRegistry registry https://registry.npmjs.org/
17 silly mapToRegistry uri https://registry.npmjs.org/npm
18 verbose addNameTag registry:https://registry.npmjs.org/npm not in flight; fetching
19 verbose request uri https://registry.npmjs.org/npm
20 verbose request no auth needed
21 info attempt registry request try #1 at 09:30:04
22 verbose request id 6fa6dc64e92e52cc
23 http request GET https://registry.npmjs.org/npm
24 info retry will retry, error on last attempt: Error: connect ETIMEDOUT
25 info attempt registry request try #2 at 09:30:35
26 http request GET https://registry.npmjs.org/npm
27 info retry will retry, error on last attempt: Error: connect ETIMEDOUT
28 info attempt registry request try #3 at 09:31:56
29 http request GET https://registry.npmjs.org/npm
30 verbose stack Error: connect ETIMEDOUT
30 verbose stack at exports._errnoException (util.js:746:11)
30 verbose stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1000:19)
31 verbose cwd c:\Program Files\nodejs
I've read some threads with problems of nodejs and found an ability to set the http proxy. Is that the solution?
I've solved my problem. To find out my proxy-server name on windows 7 I've opened command line of windows and type: netsh winhttp show proxy
Then I added these lines in the .npmrc data (path:C:\users\username)
registry=http://registry.npmjs.org/
strict-ssl=false
proxy=http://username:password#proxy.domain.com:8080/
https-proxy=http://username:password#proxy.domain.com:8080
It works fine :)

Installing Cordova on Mac Mini from Terminal gives error

I am trying to install cordova using Mac Mini Terminal.
The command I am using is as follows
sudo npm install -g cordova
I even tried without Sudo. I am connected to internet using Wifi + Lan too.
I tried disabling Wifi and connect and other way round.
I am not on proxy server. I connect to internet using a Wifi Connection which is through WIFI router. I am based in India.
I get following error.( Here is error log. )
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', '-g', 'cordova' ]
2 info using npm#1.4.28
3 info using node#v0.10.32
4 verbose cache add [ 'cordova', null ]
5 verbose cache add name=undefined spec="cordova" args=["cordova",null]
6 verbose parsed url { protocol: null,
6 verbose parsed url slashes: null,
6 verbose parsed url auth: null,
6 verbose parsed url host: null,
6 verbose parsed url port: null,
6 verbose parsed url hostname: null,
6 verbose parsed url hash: null,
6 verbose parsed url search: null,
6 verbose parsed url query: null,
6 verbose parsed url pathname: 'cordova',
6 verbose parsed url path: 'cordova',
6 verbose parsed url href: 'cordova' }
7 silly lockFile a98f2055-cordova cordova
8 verbose lock cordova /Users/vilas_den/.npm/a98f2055-cordova.lock
9 silly lockFile a98f2055-cordova cordova 10 silly lockFile a98f2055-cordova cordova
11 verbose addNamed [ 'cordova', '' ]
12 verbose addNamed [ null, '*' ]
13 silly lockFile de8d9fad-cordova cordova#
14 verbose lock cordova# /Users/vilas_den/.npm/de8d9fad-cordova.lock
15 silly addNameRange { name: 'cordova', range: '*', hasData: false }
16 verbose request where is /cordova
17 verbose request registry https://registry.npmjs.org/
18 verbose request id b73a5f8f40fd1d7c
19 verbose url raw /cordova
20 verbose url resolving [ 'https://registry.npmjs.org/', './cordova' ]
21 verbose url resolved https://registry.npmjs.org/cordova
22 verbose request where is https://registry.npmjs.org/cordova
23 info trying registry request attempt 1 at 16:31:28
24 http GET https://registry.npmjs.org/cordova
25 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND
26 info trying registry request attempt 2 at 16:31:39
27 http GET https://registry.npmjs.org/cordova
28 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND
29 info trying registry request attempt 3 at 16:32:39 30 http GET https://registry.npmjs.org/cordova
31 silly lockFile de8d9fad-cordova cordova#
32 silly lockFile de8d9fad-cordova cordova#
33 error network getaddrinfo ENOTFOUND
33 error network This is most likely not a problem with npm itself
33 error network and is related to network connectivity.
33 error network In most cases you are behind a proxy or have bad network settings.
33 error network
33 error network If you are behind a proxy, please make sure that the
33 error network 'proxy' config is set properly. See: 'npm help config'
34 error System Darwin 13.3.0
35 error command "node" "/usr/local/bin/npm" "install" "-g" "cordova"
36 error cwd /Users/vilas_den
37 error node -v v0.10.32
38 error npm -v 1.4.28
39 error syscall getaddrinfo
40 error code ENOTFOUND
41 error errno ENOTFOUND
42 verbose exit [ 1, true ]
So please let me know.

Error installing karma on Windows 7

I'm trying to install karma using
npm install -g karma
but, even as the admin, I'm getting these errors:
0 info it worked if it ends with ok
1 verbose cli [ 'Z:\\Users\\vazirin\\Downloads\\Node\\\\node.exe',
1 verbose cli 'Z:\\Users\\vazirin\\Downloads\\Node\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'karma' ]
2 info using npm#1.3.3
3 info using node#v0.10.11
4 verbose node symlink Z:\Users\vazirin\Downloads\Node\\node.exe
5 verbose cache add [ 'karma', null ]
6 verbose cache add name=undefined spec="karma" args=["karma",null]
7 verbose parsed url { protocol: null,
7 verbose parsed url slashes: null,
7 verbose parsed url auth: null,
7 verbose parsed url host: null,
7 verbose parsed url port: null,
7 verbose parsed url hostname: null,
7 verbose parsed url hash: null,
7 verbose parsed url search: null,
7 verbose parsed url query: null,
7 verbose parsed url pathname: 'karma',
7 verbose parsed url path: 'karma',
7 verbose parsed url href: 'karma' }
8 silly lockFile 512423cb-karma karma
9 verbose lock karma Z:\Users\vazirin\AppData\Roaming\npm-cache\512423cb-karma.lock
10 silly lockFile 512423cb-karma karma
11 silly lockFile 512423cb-karma karma
12 verbose addNamed [ 'karma', '' ]
13 verbose addNamed [ null, '*' ]
14 silly lockFile cd7961bb-karma karma#
15 verbose lock karma# Z:\Users\vazirin\AppData\Roaming\npm-cache\cd7961bb-karma.lock
16 silly addNameRange { name: 'karma', range: '*', hasData: false }
17 verbose url raw karma
18 verbose url resolving [ 'https://registry.npmjs.org/', './karma' ]
19 verbose url resolved https://registry.npmjs.org/karma
20 info trying registry request attempt 1 at 12:57:46
21 http GET https://registry.npmjs.org/karma
22 info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND
23 info trying registry request attempt 2 at 12:57:58
24 http GET https://registry.npmjs.org/karma
25 info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND
26 info trying registry request attempt 3 at 12:59:00
27 http GET https://registry.npmjs.org/karma
28 silly lockFile cd7961bb-karma karma#
29 silly lockFile cd7961bb-karma karma#
30 error Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND
30 error at ClientRequest.onError (Z:\Users\vazirin\Downloads\Node\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:159:17)
30 error at ClientRequest.g (events.js:175:14)
30 error at ClientRequest.EventEmitter.emit (events.js:95:17)
30 error at Socket.socketErrorListener (http.js:1517:9)
30 error at Socket.EventEmitter.emit (events.js:95:17)
30 error at net.js:829:16
30 error at process._tickCallback (node.js:415:13)
31 error If you need help, you may report this log at:
31 error <http://github.com/isaacs/npm/issues>
31 error or email it to:
31 error <npm-#googlegroups.com>
32 error System Windows_NT 6.1.7601
33 error command "Z:\\Users\\vazirin\\Downloads\\Node\\\\node.exe" "Z:\\Users\\vazirin\\Downloads\\Node\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "karma"
34 error cwd Z:\Users\vazirin
35 error node -v v0.10.11
36 error npm -v 1.3.3
37 error code ECONNRESET
38 verbose exit [ 1, true ]
Anyone have any ideas why this is happening? I have no problem running this on OS X Mountain Lion.
I ended up uninstalling node. Then used chocolatey to install it. That gave me a couple of errors but as I debugged, it turned out that for some reason, the npm config file had the wrong registry address to look up the packages. So when I executed
npm install -g karma
it would try to connect to the registry and couldn't. After fixing the address, everything worked smoothly. I was starting to question if my previously installed programs had changed any system config files or network settings. Evidently, there was no proxy issue encountered.

Install Node.js modules on private LAN with NPM?

I am trying to install node.js on a LAN that is not connected to the web. I've installed node.js with no problems, but it appears that npm wants to go out to the web, http GET https://registry.npmjs.org/moment so I can't install the modules that I need.
Here is the npm-debug file that is produced:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'moment',
1 verbose cli '-g' ]
2 info using npm#1.1.69
3 info using node#v0.8.16
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose read json C:\Documents and Settings\User.PALS-DADS\Application Data\npm\package.json
6 verbose read json C:\Documents and Settings\User.PALS-DADS\Application Data\npm\package.json
7 verbose cache add [ 'moment', null ]
8 silly cache add name=undefined spec="moment" args=["moment",null]
9 verbose parsed url { pathname: 'moment', path: 'moment', href: 'moment' }
10 silly lockFile b56def36-moment moment
11 verbose lock moment C:\Documents and Settings\User.PALS-DADS\Application Data\npm-cache\b56def36-moment.lock
12 silly lockFile b56def36-moment moment
13 verbose addNamed [ 'moment', '' ]
14 verbose addNamed [ null, '' ]
15 silly lockFile 42aa250a-moment moment#
16 verbose lock moment# C:\Documents and Settings\User.PALS-DADS\Application Data\npm-cache\42aa250a-moment.lock
17 silly addNameRange { name: 'moment', range: '', hasData: false }
18 verbose url raw moment
19 verbose url resolving [ 'https://registry.npmjs.org/', './moment' ]
20 verbose url resolved https://registry.npmjs.org/moment
21 info trying registry request attempt 1 at 16:47:42
22 http GET https://registry.npmjs.org/moment
23 info retry will retry, error on last attempt: Error: getaddrinfo ENOENT
24 info trying registry request attempt 2 at 16:47:52
25 http GET https://registry.npmjs.org/moment
26 info retry will retry, error on last attempt: Error: getaddrinfo ENOENT
27 info trying registry request attempt 3 at 16:48:52
28 http GET https://registry.npmjs.org/moment
29 silly lockFile 42aa250a-moment moment#
30 error Error: getaddrinfo ENOENT
30 error at errnoException (dns.js:31:11)
30 error at Object.onanswer [as oncomplete] (dns.js:123:16)
31 error If you need help, you may report this log at:
31 error
31 error or email it to:
31 error
32 error System Windows_NT 5.1.2600
33 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "moment" "-g"
34 error cwd C:\Documents and Settings\User.PALS-DADS\Desktop
35 error node -v v0.8.16
36 error npm -v 1.1.69
37 error syscall getaddrinfo
38 error code ENOTFOUND
39 error errno ENOTFOUND
40 verbose exit [ 1, true ]
How can I install modules without connecting to the net?
Thanks
If you take a look at the docs, you'll see that you can install packages by simply passing a filesystem path or URL to a tarball that contains the package you want to install.
npm install http://server.on.lan/moment.tgz
Of course, if the package in question specifies any dependencies, npm will try to fetch them from the web. moment doesn't have any, so you should be able to just download the tarball and install it.
However, if you want to install other packages which do have dependencies, you might be better off setting up a npm registry mirror on your LAN.

Resources