首页 > 解决方案 > TSC 2307 - Typescript - 在 Heroku 上部署时找不到模块

问题描述

我有一个 nodejs typescript 项目可以在我的本地机器上正常工作,但是当我部署到 heroku 或发送到 travis CI 时,它会显示这个错误。

运行 tsc 命令后:tsc 。

有什么帮助吗?

-----> Build Running build (yarn) yarn run v1.22.4 $ rm -rf ./dist $ tsc -p 。src/b-controllers/token/token.controller.ts(14,19):错误 TS2307:找不到模块 '../../d-domain/entities/token' 或其相应的类型声明。src/b-controllers/user/user.controller.ts(17,18):错误 TS2307:找不到模块 '../../d-domain/entities/user' 或其相应的类型声明。

我的 tsconfig:

{
    "compilerOptions": {
        "target": "es6",        
        "module": "commonjs",        
        "moduleResolution": "node",        
        "outDir": "./dist",
        "allowSyntheticDefaultImports": true,
        "sourceMap": true,
        "esModuleInterop": true,
        "strict": true,
        "noImplicitAny": false,
        "skipLibCheck": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "allowJs": true
    }
}

标签: node.jstypescript

解决方案


推荐阅读