installing websocket with nodejs

I am trying to install websocket on nodejs with npm I am getting following error.. I am installing it on windows.

npm install websocket

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'websocket@1.0.3' ]
2 info using npm@1.1.32
3 info using node@v0.8.0
4 verbose node symlink C:\Program Files (x86)\nodejs\\node.exe
5 verbose config file C:\Users\tasleem\.npmrc
6 verbose config file C:\Program Files (x86)\nodejs\etc\npmrc
7 verbose config file C:\Program Files (x86)\nodejs\node_modules\npm\npmrc
8 verbose read json C:\Program Files (x86)\nodejs\package.json
9 verbose read json C:\Program Files (x86)\nodejs\node_modules\npm\package.json
10 verbose read json C:\Program Files (x86)\nodejs\node_modules\package\package.json
11 verbose read json C:\Program Files (x86)\nodejs\node_modules\websocket-1.0.6\package.json
12 verbose read json C:\Program Files (x86)\nodejs\package.json
13 verbose cache add [ 'websocket@1.0.3', null ]
14 silly cache add name=undefined spec="websocket@1.0.3" args=["websocket@1.0.3",null]
15 verbose parsed url { pathname: 'websocket@1.0.3',
15 verbose parsed url   path: 'websocket@1.0.3',
15 verbose parsed url   href: 'websocket@1.0.3' }
16 silly cache add name="websocket" spec="1.0.3" args=["websocket","1.0.3"]
17 verbose parsed url { pathname: '1.0.3', path: '1.0.3', href: '1.0.3' }
18 verbose addNamed [ 'websocket', '1.0.3' ]
19 verbose addNamed [ '1.0.3', '1.0.3' ]
20 verbose url raw websocket/1.0.3
21 verbose url resolving [ 'https://registry.npmjs.org/', './websocket/1.0.3' ]
22 verbose url resolved https://registry.npmjs.org/websocket/1.0.3
23 http GET https://registry.npmjs.org/websocket/1.0.3
24 error Error: connect ETIMEDOUT
24 error     at errnoException (net.js:781:11)
24 error     at Object.afterConnect [as oncomplete] (net.js:772:19)
24 error  { [Error: connect ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect' }
25 error You may report this log at:
25 error     <http://github.com/isaacs/npm/issues>
25 error or email it to:
25 error     <npm-@googlegroups.com>
26 error System Windows_NT 6.1.7601
27 error command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "websocket@1.0.3"
28 error cwd C:\Program Files (x86)\nodejs
29 error node -v v0.8.0
30 error npm -v 1.1.32
31 error syscall connect
32 error code ETIMEDOUT
33 error message connect ETIMEDOUT
34 error errno ETIMEDOUT
35 error ETIMEDOUT errno
36 verbose exit [ 1, true ]

Or I have got the WebSocket package , could someone tell where to extract this inside nodejs folder?

It seems that there is a connection problem between your site and the NPM registry. Try first to connect to NPM registry in a browser, you should have the same error.

Check your network connectivity, you can also try to ping registry.npmjs.org.

a "npm up -g" cannot hurt either..

I am not sure if this can help you. I was using nodejs on windows via. Cygwin and when I tried making javascripts with websockets I had problems with the standard node installation - it was too old, I then tried to install a new version of node from inside Cygwin, however this was NOT possible, so I proceeded to install it using "node-v0.10.24-x64.msi" which can be downloaded from http://nodejs.org/download/

After download I then copied manually all contents from folder nodejs to cygwin /usr/local/bin

In order to install ws (websockets) then npm is needed and for that you need the newest version - after copying manually whole folder nodejs, then you can start cygwin and write following:

node -v

it should write something like this :

$ node -v

v0.10.24

now you can procede with following:

$ cd /usr/local/bin/node_modules/npm/bin

$ node npm-cli.js install ws

$ node npm-cli.js install websockets

the npm-cli.js is a command line interface version of npm, made in javascript and nodejs can parse it, so now ws module should be installed

-- NOTE it is very important that you copy or move the folder "node_modules" after the installation to following place :

cygwin/home/ --your user-- /node_modules

Otherwise your javascript projects will not beable to see the installed modules - it is actually strange why, but I have no answer for that - I just made a copy and then it worked

I hope you can use this answer