Search code examples
node.jssocket.io

Error: Cannot find module 'socket.io'


[~]# node node.js

Error: Cannot find module 'socket.io'

[~]# node -v
v0.10.10

socket.io installed:

npm install socket.io

npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field

Solution

  • Looks like you have installed socket.io in a different location to your current path. Either install globally like below:

    npm install -g socket.io

    Or reference the location you've installed to:

    var io = require('../lib/socket.io');