1.连接数据库出现警告DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect
解决办法是:
在连接数据库时:如下加上
mongoose.connect('mongodb://127.0.0.1:27017/dumall', { useNewUrlParser:true });
2.Failed to lookup view "error" in views
在views文件夹下添加error文件,修改app.js文件
app.set('views', path.join(__dirname,'./views'));//设置引擎,访问目录
未修改的是app.set('views', path.join(__dirname,'views'));
网友评论