Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node events.js:136 throw er; Unhandled 'error' event

I am getting events.js:136 throw er; Unhandled 'error' event don't know how and why? i have reinstalled the nodejs and mongodb as well but throwing same error.

package.json

{
"name": "bookstore",
"version": "1.0.0",
"description": "simple bookstore app",
"main": "app.js",
"devDependencies": {},
"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
    "express": "*",
    "body-parser": "*",
    "mongoose": "*"
},
"author": "AveesP",
"license": "ISC"

}

App.js code

var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
//connect to mongoose
mongoose.connect('mongodb://localhost/bookstore');
var db = mongoose.connection;
app.get('/', function(req, res) {
   res.send('Hello world!');
});
app.listen(3000);
console.log('Running on port 3000...');

enter image description here

like image 393
avees Avatar asked Feb 03 '26 05:02

avees


1 Answers

Try to use the following commands to enlarge the number of handlers that actives the watcher (listener of application changes)

sudo sysctl fs.inotify.max_user_watches=524288 sudo sysctl -p --system

like image 69
andhdo Avatar answered Feb 06 '26 22:02

andhdo