2017-04-10 1839 views
4

这是我的打字稿项目配置文件:为什么vscode在tsc找不到时会给出错误“无法在文件tsconfig.json中找到输入”?

{ 
    "compilerOptions": { 
     "sourceMap": true, 
     "target": "es5", 
     "outFile": "js/app.js" 
    }, 
    "files": [ 
     "src/main.ts", 
     "src/bootstrap.ts", 
     "libs/phaser.d.ts" 
    ], 
    "exclude": [ 
     "docs", 
     "css", 
     "index.html" 
    ] 
} 

VS代码是给我这个错误:

file: 'file:///e%3A/Programming/TypeScript/tsconfig.json' severity: 'Error' message: 'No inputs were found in config file 'e:/Programming/TypeScript/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["node_modules","bower_components","jspm_packages"]'.' at: '1,1' source: 'js'

我GOOGLE了Definition为tsconfig文件,但我找不到这个错误的来源。我在这里做错了什么?当用tsc编译它时,一切都很好。

回答

1

我遇到了一个类似的错误(由VS代码抛出),我的解决方案是添加一个.ts扩展名的文件,作为我的应用程序的入口点。 Typescript只需要编译一些东西(“输入”)。

加入

"include": [ 
    '**/*' 
] 

您tsconfig.json会照顾它也许指定include路径?

+1

当我添加了节点typescript编译器并停止使用Visual Studio 2017中的一个时,此错误最终消失。 – BadSnowflake

+0

不错!这是一个不寻常的错误,看起来修复对于每个人都不同 - 很高兴你能够正常工作。 – vincecampanale

相关问题