Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install socket.io on ubuntu

I'm working on a real time application and I'm using third party to do it. But now I have to use node.js with socket.io instead of third party .

I installed the node.js (v0.4.12) correctly and I check it using command node -v . but when I was installed the socket.io using npm install socket.io command I got this error .

npm ERR! install failed Error: Required package: options(latest) not found. (Found: ["0.0.3"])
npm ERR! install failed (required by: [email protected])
npm ERR! install failed     at /usr/share/npm/lib/build.js:192:19
npm ERR! install failed     at cb (/usr/share/npm/lib/utils/graceful-fs.js:32:9)
npm ERR! Error: Required package: options(latest) not found. (Found: ["0.0.3"])
npm ERR! (required by: [email protected])
npm ERR!     at /usr/share/npm/lib/build.js:192:19
npm ERR!     at cb (/usr/share/npm/lib/utils/graceful-fs.js:32:9)
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues>
npm ERR! or email it to <[email protected]>
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm not ok

How I can solve it?

like image 504
phpuser12 Avatar asked Dec 11 '12 18:12

phpuser12


4 Answers

I ran those commands and it worked:

  1. sudo npm install -g n
  2. sudo n 0.8.15
  3. sudo npm install socket.io
like image 51
phpuser12 Avatar answered Oct 09 '22 20:10

phpuser12


You're trying to install it without a package.json file, and in your solution you installed it globally, which is usually not what you want for socket.io.

Instead, you should include a package.json file in your working directory and either run:

> npm install socket.io --save

which will automatically append it to package.json, or your you can physically include it in the dependencies and then just run:

> npm install
like image 41
Loourr Avatar answered Oct 09 '22 22:10

Loourr


It worked:

1) sudo npm install -g n
2) sudo n 0.8.15
3) sudo npm install socket.io

like image 43
Tejashree Avatar answered Oct 09 '22 21:10

Tejashree


In some cases if you are behind a proxy and try to run:

sudo npm install socket.io

you may end up in getting error -

npm ERR! Error: shasum check failed for /tmp/npm-1393245157089/1393245157089-0.6057841922156513/tmp.tgz npm ERR! Expected: 3bab0444e49b55fbbc157424dbd41aa375a51a76 npm ERR! Actual: dae95023b71f7d06533f7c35a7d0c3b0cf729f42

then run the following

sudo npm --proxy=http://"your_proxy":"your_port" install socket.io

like image 29
suman1409 Avatar answered Oct 09 '22 21:10

suman1409