使用mongoose时如何清除节点js中的警告

Sri*_*ugu 22 mongoose mongodb node.js

我有疑问

in The Web Developer Bootcamp course from section 29,304 module
(node:15807) Warning: Accessing non-existent property 'count' of module exports inside circular dependency

(Use node --trace-warnings ... to show where the warning was created)

(node:15807) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency

(node:15807) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency

(node:15807) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
Run Code Online (Sandbox Code Playgroud)

当我使用猫鼬时,我收到了上述警告。如何清除它们?

在此处输入图片说明

jen*_*ose 14

我怀疑您使用的是全新版本的节点 14,这是我在更新后遇到的,并找到了以下解决方案:

https://jira.mongodb.org/browse/NODE-2536

tldr; 计划于 2020 年 4 月 28 日发布的新 mongodb 驱动程序版本旨在解决此问题。


GLK*_*GLK 11

在我的情况下,只是运行 npm update确实解决了问题


Jus*_*ger 6

解决了我的问题:

  1. yarn remove mongoose或者npm uninstall mongoose --save
  2. yarn add mongoose或者npm install mongoose --save