32

I'm getting this error

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

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.

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.

Opened the ide,

file > folder close

file > open folder > your folder

this fix the error.

1
  • 2
    I have resolved the error, but something strange may be a bug will try to put a update, sorry for my bad English Commented Mar 9, 2016 at 14:10

12 Answers 12

16

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

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

How does this 'answer' improve on what the OP himself already posted?
The error I was getting seemed to be because VS didn't find a folder. Hopefully someone else who's googling on the error message and a problem with not finding a folder will find this page more easily than I did. Also including the entire error message could help google rank this as more relevant. That's my reasoning.
2

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

Suppose I have created a app.kironTest.ts file under src folder. I should write following command to run my app.kironTest.ts file as my file name is app.kironTest.ts. under src directory.

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 

Comments

0

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

To remove the temp file:

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

Comments

0

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

Comments

0

I had the same error, over and over again. I try these 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.

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

Comments

0

Deleting "extends": "tslint:recommended" from your tslint.json seems to resolve this issue in Angular 9. Note: TSLint is currently deprecated in favour of ESLint, so that may have something to do with it.

Comments

0

In my case, I have an old TypeScript project (2.4) configured with Visual Studio and am using Visual Studio 2019. I deleted a .ts file outside of Visual Studio. Therefore, the deletion was not recognized by Visual Studio, but still referenced by the compiler which cannot find it, resulting in an error.

Here is how to deleted the referenced .ts file manually from the Visual Studio project file:

  1. Right click on project in the files/explorer area (the item below the solution)
  2. Unload project
  3. Edit Project File: Remove the line of the already deleted file.
<ItemGroup> <TypeScriptCompile Include="app\ts\some\path\SomeFile.ts" /> <TypeScriptCompile Include="app\ts\some\path\SomeOtherFile.ts" /> <TypeScriptCompile Include="app\ts\nonexisting\xxx.ts" /> </ItemGroup> 
  1. Save the .csproj project file and reload it. Afterwards, compiling should work again.

Comments

0

It's either:

  1. your file does not exist in the directory where you try to compile it (say you keep someFile.ts in a 'src' dir and you try to run tsc someFile.ts in the root of your project (so 1 lvl above src) it will not find it. So you need to run tsc someFile.ts inside your src in this case.

  2. if you still want to run from the root, just run tsc and it will compile everything including your initially not found file

Comments

0

If you're using yarn, try yarn tsc /full/path/to/file.ts

Comments

0

I had the same issue which .ts files were hidden when I wanted to import them and issue resolved by this setting in tsconfig.json :

"moduleResolution": "node" 

Comments

-1

First, create the folder, then add your file to it, and finally copy the correct path.

Example: C:\Users\username\Desktop\foldername\app.ts would work.

You can also try on the command line, or on vs code.

The error you indicate will appear when you add the wrong path.

1 Comment

its an old question. consider formatting the answer better and add a note as to why this is better.
-2

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

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.