最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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 mand:

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._pile (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 bination of node/socket.io versions? (I know socket.io has just gone up to 0.7).

FYI I did a pile 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'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 mand:

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._pile (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 bination of node/socket.io versions? (I know socket.io has just gone up to 0.7).

FYI I did a pile 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

Share Improve this question asked Jul 6, 2011 at 17:03 maireadmairead 611 silver badge3 bronze badges 5
  • What does the source code in question look like? We can see the stacktrace, yes, but that tells us nothing about your actual code. – jcolebrand Commented Jul 6, 2011 at 17:41
  • I believe there are issues with socket.io and node 5.0. Try 4.8 – Derrish Repchick Commented Jul 6, 2011 at 17:41
  • @jcolebrand - I have no code yet. I'm just installing the boilerplate code. I haven't created any application code. The stacktrace is ing from running a boilerplate project the first time without anything in it – mairead Commented Jul 7, 2011 at 11:30
  • @mairead that doesn't make any sense then. There must be some code for it to pile and plain about. What URL did you download the project file from? – jcolebrand Commented Jul 7, 2011 at 13:33
  • The boilerplate code is here: github./robrighter/node-boilerplate – mairead Commented Jul 7, 2011 at 14:08
Add a ment  | 

2 Answers 2

Reset to default 2

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 patible 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./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(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
├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected]  extraneous
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected] 
└─┬ [email protected] 
  ├── [email protected] 
  ├── [email protected] 
  └── [email protected] 

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./u/314941/socketio.tar.gz
发布评论

评论列表(0)

  1. 暂无评论