【问题标题】:Why is vscode giving me the error "No Inputs where found in file tsconfig.json" when tsc found none?当 tsc 找不到时,为什么 vscode 给我错误“在文件 tsconfig.json 中找不到输入”?
【发布时间】:2017-09-05 01:57:41
【问题描述】:

这是我的打字稿项目的配置文件:

{
    "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 Code 给了我这个错误:

文件:'file:///e%3A/Programming/TypeScript/tsconfig.json' 严重性:'错误'消息:'在配置文件中找不到输入 'e:/Programming/TypeScript/tsconfig.json'。指定“包括” 路径是 '["**/*"]' 和 'exclude' 路径是 '["node_modules","bower_components","jspm_packages"]'。在:'1,1' 来源:'js'

我在Definition 上搜索了 tsconfig 文件,但找不到此错误的来源。我在这里做错了什么?用 tsc 编译时,一切正常。

【问题讨论】:

    标签: typescript visual-studio-code


    【解决方案1】:

    我遇到了类似的错误(由 VS Code 引发),我的解决方案是在文件中添加一个 .ts 扩展名,作为我的应用程序的入口点。打字稿只需要编译一些东西(“输入”)。

    也许通过添加指定包含路径

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

    你的 tsconfig.json 会处理它吗?

    【讨论】:

    • 当我添加 node typescript 编译器并停止使用 Visual Studio 2017 附带的编译器时,这个错误最终消失了。
    • 不错!这是一个不寻常的错误,似乎每个人的修复方法都不一样——很高兴你让它工作了。
    • 终于为我解决了这个问题。谢谢
    【解决方案2】:

    将此添加到tsconfig.json 为我修复了它:

    "compilerOptions": {
      ...
      "rootDir": "./src",
      ...
    }
    

    【讨论】:

      猜你喜欢
      • 2017-07-04
      • 2018-04-22
      • 1970-01-01
      • 2022-10-02
      • 2017-05-03
      • 1970-01-01
      • 2018-05-31
      • 1970-01-01
      • 2021-09-26
      相关资源
      最近更新 更多