在配置文件“ tsconfig.json”中找不到输入。指定的“包含”路径位于Angular 6

时间:2018-09-21 11:01:30

标签: angular

我正在将我的4号角应用升级到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"]'.

如果我将“ ** / *”添加到包含项中,则会出现以下错误,并且上述错误消失。

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'.

tsconfig

{
  "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/**/*",
    "**/*"
  ]
}

如何解决此问题。

1 个答案:

答案 0 :(得分:3)

因为该错误表明“排除”路径为“ [“ / .spec.ts”,“ / .stub.ts” ,“ test / ** / *。ts”]', 您需要在目录或子目录中有一个* .ts文件,其中tsconfig.app.json文件驻留在其中,声明了include和exclude属性。

“ include”和“ exclude”属性列出了类似glob的文件模式。支持的全局通配符为:

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

如果全局模式的一部分仅包含*或。*,则仅包含具有受支持的扩展名的文件(例如,默认情况下.ts,.tsx和.d.ts带有.js和.jsx,如果设置了allowJs变为真实)。

You can refer this for more help