Search code examples
node.jsdebiansocket.iolenny

node.js with socket.io under debian 5 (lenny) exit with error


I installed node.js with the instructions from node.js wiki. So I put the debian sid sources in my sources list and installed node. After that I installed npm with the curl cmd from wiki site. I installed socket.io with npm. Everything till this point works without any errors.

But when I try to start my server I get this error:

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^ Error: Cannot find module 'socket.io'
    at Function._resolveFilename (module.js:320:11)
    at Function._load (module.js:266:25)
    at require (module.js:348:19)
    at Object.<anonymous> (/root/sockets/trunk/socketio/server.js:8:8)
    at Module._compile (module.js:404:26)
    at Object..js (module.js:410:10)
    at Module.load (module.js:336:31)
    at Function._load (module.js:297:12)
    at Array.<anonymous> (module.js:423:10)
    at EventEmitter._tickCallback (node.js:126:26)

I dont have any ideas why this won't work? Could anybody help?


Solution

    1. Go to the project folder. This is the folder where you run node your_server.js.
    2. Run npm install socket.io. This will add a directory under this project folder named node_modules, where, unsurprisingly, modules for this project are.
    3. Run the server with node your_server.js. This time it will work ;).

    Enjoy!