找不到模块“ connect-mongo”或其对应的类型声明

时间:2020-08-05 01:53:07

标签: mongodb typescript typescript-typings connect-mongo

没有pnpm i connect-mongo,重新安装了多次,包在那里就好了。我查看了package.json,它具有键入的有效路径,并且键入存在且正确。我正在使用打字稿,并尝试像这样导入它:

import * as mongo from "connect-mongo";

但我只会收到此错误:

    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/service/index.ts:15:36 - error TS2307: Cannot find module 'connect-mongo' or its corresponding type declarations.

import * as MongoStoreFactory from "connect-mongo";
                                      ~~~~~~~~~~~~~~~

    at createTSError (C:\Users\zaid\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:434:12)
    at reportTSError (C:\Users\zaid\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:438:19)
    at getOutput (C:\Users\zaid\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:578:36) 
    at Object.compile (C:\Users\zaid\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:775:32)
    at Module.m._compile (C:\Users\zaid\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:858:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\zaid\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:861:12)
    at Module.load (internal/modules/cjs/loader.js:1105:32)
    at Function.Module._load (internal/modules/cjs/loader.js:967:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) 

安装良好: Package installed correctly

我是否有办法忽略或解决此错误?

0 个答案:

没有答案