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