我得到node.js这个非常基本的例子process.nextTick错误。
有人可以搞清楚吗? 节点无法启动端口8000监听?
# cat nodejs.js
net = require("net");
s = net.createServer();
net.on('connection', function (c) {
c.end('hello');
});
s.listen(8000);
# node nodejs.js
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<Object> has no method 'on'
at Object.<anonymous> (/home/ec2-user/praveen/nodejs.js:4:5)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)
是吗?我已经从瑞安的演讲中复制了完全相同的命令.. – 2011-12-29 21:51:00
Node.js变化的速度非常快,以至于不能依赖超过几个月的材料。不知道该演示文稿是从何时发布的,但这是您在Node 0.6中的做法。 – sczizzo 2011-12-29 21:53:14
非常感谢..它的工作原理。我想演示文稿很老了。 – 2011-12-29 23:32:22