打字稿错误“无法写入文件...,因为它将覆盖输入文件." [英] Typescript error "Cannot write file ... because it would overwrite input file."

查看:627
本文介绍了打字稿错误“无法写入文件...,因为它将覆盖输入文件."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2015 Update 3的Typescript 2.2.1项目中,我在错误列表中收到数百个错误,例如:

In my Typescript 2.2.1 project in Visual Studio 2015 Update 3, I am getting hundreds of errors in the error list like:

无法写入文件'C:/{{my-project}}/node_modules/buffer-shims/index.js',因为它会覆盖输入文件.

Cannot write file 'C:/{{my-project}}/node_modules/buffer-shims/index.js' because it would overwrite input file.

看起来一直都是这样.它实际上并不能阻止构建,并且一切正常,但是错误列表分散了人们的注意力,并且在发生真实"错误时很难找到它们.

It looks like this all the time. It doesn't actually prevent building, and everything works just fine, but the error list is distracting and difficult to locate "real" errors when they occur.

这是我的tsconfig.json文件

{
  "compileOnSave": true,
  "compilerOptions": {
    "baseUrl": ".",
    "module": "commonjs",
    "noImplicitAny": true,
    "removeComments": true,
    "sourceMap": true,
    "target": "ES5",
    "forceConsistentCasingInFileNames": true,
    "strictNullChecks": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,

    "typeRoots": [],
    "types": [] //Explicitly specify an empty array so that the TS2 @types modules are not acquired since we aren't ready for them yet.
  },
  "exclude": ["node_modules"]
}

如何摆脱所有这些错误?

How can I get rid of all these errors?

推荐答案

通过更新为Typescript 2.3.x

It seems like this issue was fixed for me by updating to Typescript 2.3.x

此外,使用Visual Studio 2017也是一个很大的改进.我强烈建议您同时同时进行这些更新.

Also, using Visual Studio 2017 was a big improvement as well. I highly recommend that you make both of these updates though.

这篇关于打字稿错误“无法写入文件...,因为它将覆盖输入文件."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆