Reputation: 701
Hi I'm trying to follow this tutorial http://www.tokbox.com/blog/creating-chat-roulette-with-node-js-socket-io-and-opentok/
after successfully installed express, in my application folder I've updated code of Package.json file with below code as per tutorial
{
"name": "RouletteTok",
"version": "0.0.1",
"dependencies": {
"express": "2.3.11",
"jade": "0.12.1",
"opentok": "0.1.0",
"socket.io": "0.6.18"
}
}
Then I ran the command in terminal npm install But When I was trying to run the node server by giving this command node app.js it gave me an error. To be very Honest I got no idea about node js hence googled the error but couldn't figure it out. The error is as follow
/Users/UIMAC/RouletteTok1/routes/index.js:2
var router = express.Router();
^
TypeError: Object #<Object> has no method 'Router'
at Object.<anonymous> (/Users/UIMAC/RouletteTok1/routes/index.js:2:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/UIMAC/RouletteTok1/app.js:8:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Upvotes: 2
Views: 1192
Reputation: 76169
express.Router
has been added in express 4, set the express version in your package.json
to ^4.0.0
and run npm install
. Note that this might break some of your code because your current express version is really old.
Upvotes: 0