Flotype / now

NowJS makes it easy to build real-time web apps using JavaScript
http://www.nowjs.com
MIT License
1.92k stars 175 forks source link

Error: Cannot find module 'now' #226

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi All,

after searching and reading dozen of articles about this error, it still is there!!

I've tried everything i found on this matter, npm install now, npm install now -g, from package.json etc etc. I use http as well, without problems. Here's my code, perhaps i'm missing something.

This is the full error while running 'Node server.js':

Error: Cannot find module 'now'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/mmorpg/public_html/server.js:10:13)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

This is server.js:

var httpServer = require('http').createServer(function(req, response) {
    response.end('Wokring http server.');
});

httpServer.listen(1337);

console.log('Server running on port: 1337');

var nowjs = require('now');
var everyone = nowjs.initialize(httpServer);

everyone.now.logStuff = function(msg){
    console.log(msg);
}

Many thanks!