开发者

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


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
├── connect-redis@1.0.6 
├─┬ everyauth@0.2.15 
│ ├─┬ connect@1.5.2 
│ │ ├── connect-redis@1.0.6  extraneous
│ │ ├── mime@1.2.2 
│ │ └── qs@0.2.0 
│ ├── oauth@0.9.2 
│ ├── openid@0.1.8 
│ ├── restler@0.2.1 
│ └─┬ xml2js@0.1.9 
│   └── sax@0.1.4 
├─┬ express@2.4.1 
│ ├─┬ connect@1.5.2 
│ │ ├── connect-redis@1.0.6  extraneous
│ │ ├── mime@1.2.2 
│ │ └── qs@0.2.0 
│ ├── mime@1.2.2 
│ └── qs@0.2.0 
├── hiredis@0.1.12 
├── jade@0.12.4 
├── notifo@0.0.2 
├── openid@0.2.0 
├── redis@0.6.6 
└─┬ socket.io@0.7.6 
  ├── policyfile@0.0.3 
  ├── redis@0.6.0 
  └── socket.io-client@0.7.3

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).


System Version: Mac OS X 10.6.5 (10H574)
Kernel Version: Darwin 10.5.0


the-lambda-zone:node mairead.buchan$ node -v 
v0.4.9

the-lambda-zone:node mairead.buchan$ npm -v
1.0.15

/Users/mairead.buchan/Documents/WORK/node
├─┬ express@2.4.2 
│ ├─┬ connect@1.5.2 
│ │ └── connect-redis@1.0.6  extraneous
│ ├── mime@1.2.2 
│ └── qs@0.2.0 
├── redis@0.6.6 
└─┬ socket.io@0.7.6 
  ├── policyfile@0.0.3 
  ├── redis@0.6.0 
  └── socket.io-client@0.7.3 

the-lambda-zone:node mairead.buchan$ mkdir -p ~/tmp
the-lambda-zone:node mairead.buchan$ cd ~/tmp
the-lambda-zone:tmp mairead.buchan$ curl http://dl.dropbox.com/u/314941/socketio.tar.gz
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜