TypeScript TS6053:找不到文件“.ts”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35893723/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:59:13  来源:igfitidea点击:

TypeScript TS6053: File ' .ts' not found

typescriptvisual-studio-code

提问by Angel Angel

I'm getting this error

我收到这个错误

error TS6053: File 'xxx.ts' not found.

错误 TS6053:找不到文件“xxx.ts”。

but the files compiles fine yesterday, but today no, after reviewing, I made this simple test

但是昨天文件编译得很好,但今天不行,经过,我做了这个简单的测试

class HelloWorld {

    public static main(): number{

    return 0;    
    }
}
HelloWorld.main();

but I get the same error, anyone know the reason for this or may be the error

但我遇到了同样的错误,任何人都知道原因或可能是错误

error TS6053: File 'HelloWorld.ts' not found.

错误 TS6053:找不到文件“HelloWorld.ts”。

https://github.com/Microsoft/TypeScript/blob/v1.6.2/src/compiler/diagnosticMessages.json#L2205

https://github.com/Microsoft/TypeScript/blob/v1.6.2/src/compiler/diagnosticMessages.json#L2205



UPDATE:

更新:

Closing the ide, and open the error does not solve everything was the same.

关闭ide,然后打开错误并不能解决一切都一样。

Opened the ide,

打开ide,

file> folder close

file> folder close

file> open folder> your folder

file> open folder> 你的文件夹

this fix the error.

这修复了错误。

回答by Emanuel Lindstr?m

I got this "TS6053" error because Visual Studio 2017 didn't find a folder I added to a Angularjs project.

我收到此“TS6053”错误,因为 Visual Studio 2017 没有找到我添加到 Angularjs 项目的文件夹。

The solution posted above by Angel Angel to restart the IDE(or Visual Studio) in my case) fixed the issue.

上面由 Angel Angel 发布的用于重新启动 IDE(或 Visual Studio)的解决方案解决了该问题。

Hopefully this answer can help someone who's googling for the error and visual studio. I'll also include the entire error message to catch searches for the same error.

希望这个答案可以帮助那些在谷歌上搜索错误和视觉工作室的人。我还将包含整个错误消息以捕获对相同错误的搜索。

Severity Code Description Project File Line Suppression State Error TS6053 File 'C:/Users/.../my_project/node_modules/xlsx/types' not found. my_project JavaScript Content Files 1 Active

Closing and opening Visual Studio fixed my issue.Thanks to Angel Angel

关闭和打开 Visual Studio 解决了我的问题。感谢天使天使

回答by Md Farid Uddin Kiron

The main reason of this error is to running TypeScript filecompile command in a wrong directory.

此错误的主要原因是TypeScript file在错误的目录中运行编译命令。

Superpose I have crated a app.kironTest.tsfile under srcfolder so I should write following command to run my app.kironTest.tsfile as my file name is app.kironTest.ts. under srcdirectory.

叠加我app.kironTest.tssrc文件夹下创建了一个文件,所以我应该编写以下命令来运行我的app.kironTest.ts文件,因为我的文件名是app.kironTest.ts. src目录下。

tsc .\app\app.kironTest.ts

Above command run successfully.

以上命令运行成功。

But If you command like below:

但是如果你像下面这样命令:

app.kironTest.ts

You would get following error

你会得到以下错误

enter image description here

在此处输入图片说明

Correct Command would be:

正确的命令是:

tsc .\app\app.kironTest.ts

回答by Muhammad Awais

I fixed this issue by restarting the VS Code and deleting the temp files.

我通过重新启动 VS Code 并删除临时文件来解决此问题。

To remove the temp file:

要删除临时文件:

Click start > Run > Type > %temp% > Enter

回答by Julian Reta

I got the same error but I was using visuals studio code and in the command center I thought it was in the typescript folder but forgot there was another folder that was created automatically which than I did - c:\Projects\Typescript> cd .vs c:\Projects\Typescript\ .vs\tsc app.ts For me it was just something small. Just in case anyone else's problem could be the same. I only remembered creating a typescript folder and forgot that it automatically made a .vs folder also which the app.ts was in. And it created my app.js

我遇到了同样的错误,但我使用的是 Visuals Studio 代码,在命令中心,我认为它在 typescript 文件夹中,但忘记了另一个自动创建的文件夹,比我做的 - c:\Projects\Typescript> cd .vs c:\Projects\Typescript\.vs\tsc app.ts 对我来说这只是一些小事。以防万一其他人的问题可能是相同的。我只记得创建了一个打字稿文件夹,忘记了它自动创建了一个 .vs 文件夹,app.ts 也在其中。它创建了我的 app.js

回答by Hector Rugerio

I had the same error, overand over again. I try this possible answers: 1.-Restart the IDE but the same error reappears 2.-Close and open my folder, but no... 3.-I put the complete address in the terminal but I still got an error.

我有同样的错误,一遍又一遍。我尝试了以下可能的答案: 1.-重新启动 IDE,但再次出现相同的错误 2.-关闭并打开我的文件夹,但没有... 3.-我在终端中输入了完整地址,但仍然出现错误。

Finally I do-> right click on the archive -> select, Open in terminal

最后我做-> 右键单击​​存档-> 选择,在终端中打开



Tenia el mismo error una y otra vez. Intente con las siguientes soluciones: 1.-Reiniciar el IDE pero el error persistia 2.-Cerrar y abrir mi folder pero no... 3.-Puse la direccion completa en la terminal pero salia error todavia.

Tenia el mismo 错误 una y otra vez。Intente con las siguientes soluciones: 1.-Reiniciar el IDE pero el error persistia 2.-Cerrar y abrir mi folder pero no... 3.-Puse la direccion completa en la terminal pero salia error todavia。

Finalmente hice -> click derecho sobre el archivo -> abrir en terminal

Finalmente hice -> 点击 derecho sobre el archivo -> abrir en terminal

回答by Pratyush Dhanuka

I had similar issue, a bunch of files were giving TS6053: File ' .cs' not found

我有类似的问题,一堆文件给出了 TS6053: File '.cs' not found

Checking out the project and undoing all changes on the project solved the issue for me

检查项目并撤消项目的所有更改为我解决了这个问题