Node.js – events js 72 throw er unhandled 'error' event -
i'm new node.js , wish run program using streams. other programs, had start server simultaneously (mongodb, redis, etc) have no idea if i'm supposed run 1 this. please let me know going wrong , how can rectify this. in advance.
this program:
var http = require('http'), feed = 'http://isaacs.iriscouch.com/registry/_changes?feed=continuous'; function decide(cb) { settimeout(function () { if (date.now()%2) { return console.log('rejected'); } cb(); }, 2000); } http.get(feed, function (res) { decide(res.pipe.bind(res, process.stdout)); //using anonymous function instead of bind: // decide(function () { // res.pipe(process.stdout) // }); });
this cmd output:
<b>c:\05-employing streams\05-employing streams\23-playing pipes>node npm_stre am_piper.js events.js:72 throw er; // unhandled 'error' event ^ error: parse error @ socket.socketondata (http.js:1583:20) @ tcp.onread (net.js:527:27) </b>
close nodejs app
running in shell. restart terminal , run program again.
another server might using same port have used nodejs. kill process using nodejs port
, run app.
to find pid of application using port:8000
$ fuser 8000/tcp 8000/tcp: 16708
here pid 16708 kill process using kill [pid]
command
$ kill 16708
Comments
Post a Comment