Cannot find module "Socket.IO- node" when trying to start a node.js project

I get an error when I try to start a project created using the node.js template project. I installed socket.io using NPM with this command:

npm install socket.io

The error I am 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 have some kind of incorrect combination of node / socket.io versions? (I know socket.io just rose to 0.7).

FYI Yesterday I did a compilation from the source for node (using 5.0) and installed everything else today using NPM, so everything should be running in the latest version

Is node.js template deprecated with changes to socket.io project?

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

I would like to consult. thank you all thank you

+6
source share
2 answers

I believe that you should use the latest stable build (0.4.9) . I believe that branch 0.5.x has some API changes that are incompatible 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 is running

 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. 

Only works for me. I think you should provide the same information (try my socket.io code provided in the curl link).

+2
source
 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
source

Source: https://habr.com/ru/post/892160/


All Articles