警告:在循环依赖中访问模块导出的不存在的属性“MongoError" [英] Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
问题描述
我正在使用节点进行 API 并使用 Mongoose.当我给一个 yarn dev
启动我的 Nodemon 时,Mongo 出现错误,我不知道如何解决这个问题.有人会有什么想法吗?(我使用的是 MongoDB Atlas 数据库)
I'm doing API with the node and using Mongoose. When I give a yarn dev
to start my Nodemon, there is an error in Mongo, I have no idea how to solve this. Would anyone have any ideas? (I'm using the MongoDB Atlas database)
就在以下错误之后.
yarn run v1.22.5
$ nodemon src/server.js
[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node src/server.js`
(node:752) Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:752) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.
我正在使用
- 节点 v14.15.4
- npm 6.14.10
我的 package.json
My package.json
{
"name": "backend",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "nodemon src/server.js"
},
"dependencies": {
"express": "^4.17.1",
"md5": "^2.3.0",
"mongoose": "^5.11.16",
"multer": "^1.4.2",
"yarn": "^1.22.10"
},
"devDependencies": {
"nodemon": "^2.0.7"
}
}
推荐答案
刚发现这个,警告可以忽略,后续更新会修复
Just found this, warning can be ignored it will be fixed in the coming updates
大家好,
感谢举报!我今天自己解决了这个问题在职的.我联系了 Node 驱动程序团队.警告是安全的忽略并有望在即将发布的版本中消失.
Thanks for reporting! I hit the issue myself today while I was working. I checked in with the Node driver team. The warning is safe to ignore and will hopefully be gone in an upcoming release.
这篇关于警告:在循环依赖中访问模块导出的不存在的属性“MongoError"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!