【问题标题】:No input was found in config file tsconfig.json在配置文件 tsconfig.json 中找不到输入
【发布时间】:2018-04-22 15:39:10
【问题描述】:

通过 npm,我为我的应用程序下载了 angular2-highcharts。我刚刚注意到 Visual Studio Code 在包的 tsconfig.json 文件中给了我一个错误:

file: 'file:///c%3A/pdws-view-v2/node_modules/angular2-highcharts/tsconfig.json'
severity: 'Error'
message: 'No inputs were found in config file 'c:/pdws-view-v2/node_modules/angular2-highcharts/tsconfig.json'. Specified 'include' paths were '["src/**/*"]' and 'exclude' paths were '["examples","index.d.ts","node_modules","dist"]'.'
at: '1,1'
source: 'ts'

我真的不知道为什么会收到此错误或如何修复它。

这是文件:

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "removeComments": true,
    "sourceMap": true,
    "outDir": "dist",
    "declarationDir": "dist",
    "declaration": true
  },
  "compileOnSave": true,
  "include": [
    "src/**/*"
  ],
  "exclude": [
    "examples",
    "index.d.ts",
    "node_modules",
    "dist"
  ],
  "angularCompilerOptions": {
    "genDir": "dist/",
    "strictMetadataEmit": true,
    "skipTemplateCodegen": true
  }
}

有什么想法吗?谢谢!

【问题讨论】:

    标签: json angular typescript angular2-highcharts


    【解决方案1】:

    就我而言,我忘了这样做: COPY src/ ./src/ 它将复制我的 src 文件夹。然后复制后,我现在可以运行: RUN yarn install --ignore-engines RUN yarn tsc

    【讨论】:

      【解决方案2】:

      TS 编译器希望在 tsconfig.json 所在的目录中有一个 .ts 文件。 在同一目录中创建一个空 file.ts,错误应该会消失。

      【讨论】:

        【解决方案3】:

        一般来说,如果是图书馆的问题,您应该:

        • 搜索the library's issue tracker 寻找类似问题
        • 如果没有找到,create one根据他们提供的问题模板,尽可能详细地说明你正在编译的环境(尤其是 TypeScript、tslint 和 npm 版本,以及您的编辑器和操作系统)。

        也就是说,他们的问题模板特别要求您首先在此处查看,所以请等待,看看是否有其他人为您的案例提供已知解决方案。

        你不能真正在本地修复它,因为它在包的源代码中,所以下次你 npm install 或 npm update 时,你的更改将被删除。

        当然,如果您在本地调试并找到解决方案,我相信他们会欢迎拉取请求。

        实际上,听起来到源的相对路径是不正确的,但如果能将其发布,那将是令人惊讶的。所以这可能是 VSCode 或您的 linter 报告中的错误。

        这还假设您拥有最新版本的软件包(@latest 甚至 @next)。

        【讨论】:

        • 谢谢,我拭目以待。
        • @Jesper 这个答案是为了提供规范的指导,但至少如果你在这里没有得到任何有用的东西,你可以放心地去 github。
        猜你喜欢
        • 2017-05-03
        • 2022-10-02
        • 2017-09-05
        • 1970-01-01
        • 2017-07-04
        • 1970-01-01
        • 2022-07-19
        • 2015-09-27
        • 1970-01-01
        相关资源
        最近更新 更多