找不到模块 'bson' 的声明文件
Could not find a declaration file for module 'bson'
我做了一个 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 containing declare module 'bson';
46 import { Binary, Decimal128, Double, Int32, Long, ObjectId,
Timestamp } from "bson";
我之前完全没有报错,怎么就因为上面的运行就报错了?
我尝试了 运行 npm i --save-dev @types/bson
,但没有解决问题。
我可以通过在上面添加 // @ts-ignore
来解决这个问题:
import { Binary, Decimal128, Double, Int32, Long, ObjectId, Timestamp } from "bson";
在 @types/mongodb
包内。
同时安装 bson 来解决这个问题
npm i --save-dev bson
由于某种原因,它似乎没有包含在 mongo 部门中
我做了一个 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
,但没有解决问题。
我可以通过在上面添加 // @ts-ignore
来解决这个问题:
import { Binary, Decimal128, Double, Int32, Long, ObjectId, Timestamp } from "bson";
在 @types/mongodb
包内。
同时安装 bson 来解决这个问题
npm i --save-dev bson
由于某种原因,它似乎没有包含在 mongo 部门中