节点events.js:136 throw er; 未处理的“错误”事件

Owa*_*s p 3 mongodb node.js npm express

我正在获取events.js:136 throw er; 未处理的“错误”事件不知道如何以及为什么?我也重新安装了nodejs和mongodb,但抛出相同的错误。

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"
Run Code Online (Sandbox Code Playgroud)

}

App.js代码

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...');
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

and*_*hdo 5

尝试使用以下命令来扩大激活观察程序的处理程序的数量(应用程序更改的侦听器)

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