1.Node.js(windows系统):ExperimentalWarning: The fs.promises API is experimental
根本原因是node的版本不是最新的,而在项目引入的模块是最新的,node.js的版本低于模块的版本:
解决方法是升级npm,node.js:
npm install npm@latest -g
https://nodejs.org/zh-cn/中下载最新的版本进行同路径安装。
还有一点要说一下,网上很多的说法都是先安装 n 模块 sudo npm install -g n (在此之前清除 npm cache cache sudo npm cache clean -f ),参考的博客 http://blog.youkuaiyun.com/sruru/article/details/46301405 。
可是我的电脑执行后是这样的:
2.(node:21724) 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.
在connect函数中加入入参:{useNewUrlParser:true}
MongoClient.connect(dbUrl, {useNewUrlParser:true},(err,client)=>{
if(err){
reject(err)
}else{
_that.dbClient=client.db(Config.dbName);
resolve(_that.dbClient)
}
})