NodeJS running Git´s project example

68 Views Asked by At

I´m starting studying nodejs to a project, and looking for projects to help me, I found out this one:

https://github.com/kroky/woot

It´s very interesting implementation on Collaborative Rich-Text editor, but, as I´m sayd, I´m starting on it, and I could not run the example from project.

Can anybody explain me how to do this?

I´m already tried to run the file on node folder

node app.js

It failed with:

module.js:338
    throw err;
          ^
Error: Cannot find module 'socket.io'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/celso/derbyjs/examples/woot/woot/node/app.js:3:10)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

Should the project have a package.json with dependencies descriptions?

Thanks for the help!

2

There are 2 best solutions below

1
On BEST ANSWER

The error message is very clear: you don't have the module socket.io. Run npm install socket.io to grab it.

If the project has a package.json file (the example you provided doesn't have one, bad practice), then before start, you should run npm install to grab all dependencies.

0
On

After cloning any node project first thing to be done is

npm install

and if it still emit error try

npm install "module name from error"

Happy coding!