开发者

nodejs itermettingly cannot createServer

This part of the app is pretty basic code straight out of the nowjs example:

Default nowjs application:

var fs = require('fs');
var server = require('http').createServer(function(req, response){
    fs.readFile('helloworld.html', function(err, data) {
        if (err) throw err;
        response.writeHead(200, {'Content-Type':'text/html'});
        response.write(data);··
       开发者_开发知识库 response.end();
    });
});
server.listen(8080);
var everyone = require("/usr/local/lib/node/.npm/now/active/package/lib/nowServerLib.js").initialize(server);

Amateurishly implemented real time twitterish application.

Sometimes my application starts fine, other times I get this error:

Error: create requires at least one (1) argument.
    at Object.wrap (/usr/local/lib/node/.npm/now/0.5.1/package/lib/wrap.js:8:18)
    at EventEmitter.ClientGroup (/usr/local/lib/node/.npm/now/0.5.1/package/lib/clientGroup.js:107:20)
    at Object.initialize (/usr/local/lib/node/.npm/now/0.5.1/package/lib/nowServerLib.js:190:14)
    at Object.<anonymous> (/home/user/projects/nodetwitter/helloworld_server.js:11:90)
    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)

There doesn't appear to be any reason for one or the other. It can go 5+ runs without hitting the error or it can happen every time.

Environment is: ubuntu 10.04, node 0.4.6


Your error seems to be coming from NowJS, specifically from https://github.com/Flotype/now/blob/613e379cd35349d212444d698a0267897dcabde5/lib/wrap.js#L8.

I see that you are using 0.5.1 instead of 0.5.3, the latest version. I would try updating to the latest version of NowJS.

Regardless, it is pretty strange that it works sometimes and fails other times!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜