socket.io.js not found socket.io.js not found express express

socket.io.js not found


Please check your Express version. Express recently is updated to 3.0alpha which API was changed. If 3.0 you can change your code to something likes this:

var express = require('express')  , http = require('http');var app = express();var server = http.createServer(app);var io = require('socket.io').listen(server);...server.listen(8000);

Same issue with connect: https://github.com/senchalabs/connect/issues/500#issuecomment-4620773


Using with the Express 3 web framework: (from socket.io)

> Express 3 requires that you instantiate a http.Server to attach socket.io to first:

meaning - (1) you must create a server instance:

var app = express();var http = require('http').createServer(app);

(2) couple it with the socket.io:

var io = require('socket.io');io.listen(http);

and ONLY THEN - (3) make the server listen:

http.listen(8080);

make sure you keep this order!


After installing node 0.8.1 I had the same problem.I just deleted the node_modules map in my project folder and reinstalled express/socket.io.After that it worked fine again with the code in your question.