Warning: Accessing non-existent property 'MongoError' of module exports inside circular dependency

Guilherme Oliveira picture Guilherme Oliveira · Feb 13, 2021 · Viewed 46.9k times · Source

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)

Right after the following error.

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.

I'm using the

  • Node v14.15.4
  • npm 6.14.10

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"
  }
}

Answer

Rumesh picture Rumesh · Feb 15, 2021

Just found this, warning can be ignored it will be fixed in the coming updates

Hi All,

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.

https://developer.mongodb.com/community/forums/t/warning-accessing-non-existent-property-mongoerror-of-module-exports-inside-circular-dependency/15411/6