Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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"
  }
}
like image 288
Guilherme Oliveira Avatar asked Feb 13 '21 13:02

Guilherme Oliveira


2 Answers

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

like image 85
Rumesh Avatar answered Nov 17 '22 01:11

Rumesh


Same issue here but =>

npm install [email protected] 

fix the error message.

Don't forget to check the package.json if it automatically changed it to 5.11.15, if not => type it manually.

like image 36
Ivo Tsochev Avatar answered Nov 17 '22 01:11

Ivo Tsochev