在NestJS项目中尝试使用Mongoose时,不断出现相同的错误
我得到以下错误:在NestJS项目中尝试使用Mongoose时,不断出现相同的错误,mongoose,nestjs,Mongoose,Nestjs,我得到以下错误: node_modules/mongoose/index.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentDefinition, FilterQuery, UpdateQuery, NativeError, Mongoose, SchemaTypes, STATES, connection, connecti
node_modules/mongoose/index.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentDefinition, FilterQuery, UpdateQuery, NativeError, Mongoose, SchemaTypes, STATES, connection, connections, models, mongo, version, CastError, ConnectionOptions, Collection, Connection, disconnected, connected, connecting, disconnecting, uninitialized, Error, QueryCursor, VirtualType, Schema, SchemaDefinition, SchemaTypeOpts, Subdocument, Array, DocumentArray, Buffer, ObjectId, ObjectIdConstructor, Decimal128, Map, Query, mquery, Aggregate, SchemaType, Promise, PromiseProvider, Model, Document, ModelUpdateOptions
到目前为止,我已经尝试删除我所有的node_modules文件夹,再次安装npm,我也尝试了这样做
rm-射频节点单元模块
npm安装-gnpm@latest
npm i核心util是
到目前为止,出现了同样的错误,我真的很困惑这里到底出了什么问题。
@nestjs/mongoose@7.2.3
使用mongoose@5.11.17
<代码>mongoose@5.11.0引入了自己的类型,并使用@types/mongoose
打破了所有集成。看起来您需要删除@types/mongoose
并更新项目中的打字以与mongoose@5.11.0
@nestjs/mongoose@7.2.3
使用mongoose@5.11.17
<代码>mongoose@5.11.0引入了自己的类型,并使用@types/mongoose
打破了所有集成。看起来您需要删除@types/mongoose
并更新项目中的打字以与mongoose@5.11.0
如果您正在使用@nestjs/mongoose
,您是否也在使用@types/mongoose
?是的,我想这就是问题所在!如果您正在使用@nestjs/mongoose
,您是否也在使用@types/mongoose
?是的,我想这就是问题所在!这是一个需要重构的项目。另一个选择是将@nestjs/mongoose
的版本下拉到~7.1.0
,并确保使用mongoose
~5.10.0
@nestjs/mongoose 7.0.2和mongoose 5.10.13应该可以,确保删除“^”以避免更新。是的!这就是解决办法!这是一个需要重构的项目。另一个选择是将@nestjs/mongoose
的版本下拉到~7.1.0
,并确保使用mongoose
~5.10.0
@nestjs/mongoose 7.0.2和mongoose 5.10.13应该可以,确保删除“^”以避免更新。是的!这就是解决办法!