小编Ven*_*l P的帖子

找不到模块,因为 tsconfig.json 中提到了路径

我的打字稿代码为 tsconfig.json 中指定的路径提供了以下错误。请指导我解决这个问题。

错误:在 Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) 中找不到模块“流/数学”

文件夹结构

src/flows/Maths.ts

export class Maths {
    public add() {
        console.log('Add method')
    }
}
Run Code Online (Sandbox Code Playgroud)

src/specs/Start.ts

import { Maths } from "@flows/Maths";
new Maths().add();
Run Code Online (Sandbox Code Playgroud)

配置文件

{
  "compilerOptions": {
    /* Basic Options */
    "target": "es5",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
    "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
    // "lib": [],                             /* Specify library files to be included in the …
Run Code Online (Sandbox Code Playgroud)

node.js typescript ecmascript-6 protractor angular

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

angular ×1

ecmascript-6 ×1

node.js ×1

protractor ×1

typescript ×1