Since I've updated from 0.4.2 to 0.4.5, every time a user successfully login I get the following error:
/home/chat/lets-chat/app/controllers/presence.js:29
User.findById(userId, function (err, user) {
^
TypeError: Cannot read property 'findById' of undefined
at Namespace.<anonymous> (/opt/lets-chat/app/controllers/presence.js:29:13)
at Namespace.emit (events.js:129:20)
at Namespace.emit (/opt/lets-chat/node_modules/express.oi/node_modules/socket.io/lib/namespace.js:205:10)
at /opt/lets-chat/node_modules/express.oi/node_modules/socket.io/lib/namespace.js:172:14
at process._tickCallback (node.js:355:11)
Upon taking my afternoon inspecting code, I caught the require-tree package not loading any of the three (3) directories: models, middlewares and controllers.
After taking some minutes of research I decided to edit app.js:33 as follows:
Since I've updated from 0.4.2 to 0.4.5, every time a user successfully login I get the following error:
Upon taking my afternoon inspecting code, I caught the require-tree package not loading any of the three (3) directories: models, middlewares and controllers.
After taking some minutes of research I decided to edit app.js:33 as follows:
Which apparently fixes this mess :)
Some info:
Edit: wrong lines of code