3

通过 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
  }
}

有任何想法吗?谢谢!

4

3 回答 3

3

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

于 2019-01-15T11:44:34.920 回答
0

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

于 2021-04-13T19:42:49.697 回答
0

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

  • 在图书馆的问题跟踪器中搜索类似问题
  • 如果没有找到,请根据他们提供的问题模板创建一个 ,尽可能详细地说明您正在编译的环境(尤其是 TypeScript、tslint 和 npm 版本,以及您的编辑器和操作系统)。

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

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

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

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

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

于 2017-11-09T15:28:09.693 回答