【发布时间】:2020-01-17 08:52:39
【问题描述】:
我在使用 Node.js 时在我的 shell 上收到一条弃用警告消息。它开始出现在我的项目中间,我不知道如何摆脱它......
我已经安装了 Axios、Express 和 Mongoose 作为依赖项。这就是我的 package.json 的样子:
{
"name": "backend",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "nodemon src/index.js"
},
"dependencies": {
"axios": "^0.19.1",
"express": "^4.17.1",
"mongoose": "^5.8.7"
},
"devDependencies": {
"nodemon": "^2.0.2"
}
}
这是终端上显示的内容:
yarn run v1.17.0
$ nodemon src/index.js
[nodemon] 2.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node src/index.js`
(node:15702) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
有谁知道如何摆脱贬低警告?
(node:15702) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
谢谢!
【问题讨论】:
标签: node.js mongodb express mongoose axios