angular - 在配置文件 'tsconfig.json' 中找不到任何输入。指定的 'include' 路径在 Angular 6 中

标签 angular

我正在将我的 angular 4 应用程序升级到 angular 6 应用程序。构建我的应用程序时出现以下错误。

error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["../../node_modules/@wtw/**/*"]' and 'exclude' paths were '["**/*.sp
ec.ts","**/*.stub.ts","test/**/*.ts"]'.

Error: error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["../../node_modules/@wtw/**/*"]' and 'exclude' paths were '["
**/*.spec.ts","**/*.stub.ts","test/**/*.ts"]'.

如果我将“**/*”添加到 include 中,我会收到以下错误,并且上述错误消失。

ERROR in e2e/app.e2e-spec.ts(3,1): error TS2304: Cannot find name 'describe'.
e2e/app.e2e-spec.ts(6,3): error TS2304: Cannot find name 'beforeEach'.
e2e/app.e2e-spec.ts(10,3): error TS2304: Cannot find name 'it'.
e2e/app.e2e-spec.ts(12,5): error TS2304: Cannot find name 'expect'.

配置文件

{
  "compileOnSave": false,

  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types",
      "type-definition"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },

  "include": [
    "../node_modules/@wtw/**/*",
    "**/*"
  ]
}

我该如何解决这个问题。

最佳答案

因为错误说“排除”路径是“["/.spec.ts","/.stub.ts""测试/**/*.ts"]', 您需要在目录或子目录中有一个 *.ts 文件,其中 tsconfig.app.json 文件包含声明的 include 和 exclude 属性。

“include”和“exclude”属性采用类似 glob 的文件模式列表。支持的 glob 通配符是:

  • '*' 匹配零个或多个字符(不包括目录分隔符)
  • '?'匹配任何一个字符(不包括目录分隔符)
  • '**/'递归匹配任何子目录

如果 glob 模式的一段仅包含 * 或 .*,则仅包含具有受支持扩展名的文件(例如,如果设置了 allowJs,则默认情况下为 .ts、.tsx 和 .d.ts,以及 .js 和 .jsx为真)。

You can refer this for more help

关于angular - 在配置文件 'tsconfig.json' 中找不到任何输入。指定的 'include' 路径在 Angular 6 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52442315/

相关文章:

Angular FormArray : Cannot find control with path

Angular 在 View 呈现之前设置 Array[]

angular - 如何在本身通过主路由器 socket 提供服务的组件内使用 Angular 路由器 socket ?

angular - @ViewChildren Querylist 数组在使用 *ngFor 渲染子项时为空

angular - 找不到名称 'viewport'

angular - 如何在 ionic 中移动幻灯片时调用函数

angular - 由于错误 : Error: Module build failed: Error: ENOENT: no such file or directory, 打开,预呈现失败

javascript - Angular: *ng对于字符串数组,删除 '/' 符号

javascript - 如何强制路由器更新 Angular 2 中的当前路由?

angular - 如何在 chrome 浏览器中调试 nativescript 应用程序并在 chrome 中查看输出