我执行了 rm -rf node_modules && npm cache verify && npm install && npm run start
现在我的控制台正在提示
node_modules/@types/mongodb/index.d.ts:46:78 - error TS7016: Could not find a declaration file for module 'bson'. '/Users/microurb/Projects/backend/node_modules/bson/index.js' implicitly has an 'any' type. Try
npm i --save-dev @types/bson
if it exists or add a new declaration (.d.ts) file containingdeclare module 'bson';
46 import { Binary, Decimal128, Double, Int32, Long, ObjectId, Timestamp } from "bson";
我之前完全没有报错,怎么运行上面就报错了?
我尝试运行 npm i --save-dev @types/bson
,但这并没有解决问题。
最佳答案
通过安装 bson 来解决这个问题
npm i --save-dev bson
由于某种原因,它似乎没有包含在 mongo dep 中
关于node.js - 找不到模块 'bson' 的声明文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69353924/
相关文章:
javascript - 无法从 'localStorage' 读取 'Window' 属性 : A
node.js - SassError : Can't find stylesheet to imp
next.js - 如何在 Next.js 中排除单个路由中的尾部斜线?
google-cloud-platform - 将 PHP crypt MD5 密码导入 Googl
python - 在 Python@3.10 上安装 cytoolz 时出现问题
html - 使用 CSS 将文本颜色设置为红色背景上的白色和白色背景上的黑色文本颜色