Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

process.nextTick error in node.js?

Tags:

node.js

enter image description here

I am getting process.nextTick error on this very basic example of node.js.

Can someone please figure out? Is node not able to start listening on port 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)
like image 659
P K Avatar asked Dec 29 '11 21:12

P K


1 Answers

It's a typo in Ryan's slide! :-0

s/net.on/s.on/
like image 86
danmactough Avatar answered Sep 28 '22 04:09

danmactough