Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module 'Socket.IO-node' when trying to run node.js boilerplate project

I'm getting an error when I try to run a project created with the node.js boilerplate project I've installed socket.io using NPM with this command:

npm install socket.io

The error I'm getting is:

node.js:189
        throw e; // process.nextTick error, or 'error' event on first tick
    ^
Error: Cannot find module 'Socket.io-node'
    at Function._resolveFilename (module.js:317:11)
    at Function._load (module.js:262:25)
    at require (module.js:346:19)
    at Object.<anonymous> (/Users/mairead.buchan/Documents/WORK/auto-aggro/server.js:6:12)
    at Module._compile (module.js:406:26)
    at Object..js (module.js:445:10)
    at Module.load (module.js:334:31)
    at Function._load (module.js:293:12)
    at Array.<anonymous> (module.js:458:10)
    at EventEmitter._tickCallback (node.js:181:26)

My question is, do I either have some kind of incorrect combination of node/socket.io versions? (I know socket.io has just gone up to 0.7).

FYI I did a compile from source for node yesterday (using 5.0) and have installed everything else using NPM today so it should all be the running at the latest version

Is node.js boilerplate out of date with changes to the socket.io project?

or is there another way to specifically install socket.io-node that I can't find. All the answers seem to point to just installing socket.io.

Would love some advice. am a total noob, thanks

like image 311
mairead Avatar asked Jul 06 '11 17:07

mairead


1 Answers

I believe you should use the latest stable build(0.4.9). I believe the 0.5.x branch has some API changes which is not compatible with socket.io(0.7.x).

alfred@alfred-laptop:~/node/socketio$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"

alfred@alfred-laptop:~$ node -v
v0.4.9
alfred@alfred-laptop:~$ npm -v
1.0.15

alfred@alfred-laptop:~/node/socketio$ npm ls
/home/alfred
├── [email protected] 
├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected]  extraneous
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └─┬ [email protected] 
│   └── [email protected] 
├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected]  extraneous
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
├── [email protected] 
└─┬ [email protected] 
  ├── [email protected] 
  ├── [email protected] 
  └── [email protected]

alfred@alfred-laptop:~$ mkdir -p ~/tmp
alfred@alfred-laptop:~/tmp$ cd ~/tmp
alfred@alfred-laptop:~/tmp$ curl http://dl.dropbox.com/u/314941/socketio.tar.gz | tar xvz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 32752  100 32752    0     0  27122      0  0:00:01  0:00:01 --:--:-- 40685
socketio/
socketio/public/
socketio/nodemon-ignore
socketio/.monitor
socketio/app.js
socketio/public/jquery-1.6.1.min.js
socketio/public/index.html

alfred@alfred-laptop:~/tmp$ node socketio/app.js info - socket.io started

google alfred@alfred-laptop:~/tmp$ google-chrome http://localhost:3000/
[23812:23829:31307528453:ERROR:io_thread.cc(120)] Invalid IP address specified for --dns-server: 
Created new window in existing browser session.

Works just for me. I think you should provide the same information(try my socket.io code specified in curl link).

like image 74
Alfred Avatar answered Nov 07 '22 19:11

Alfred