To solve the error “Could not resolve the path with the extensions ‘.ts’, ‘.tsx’” you can use the tsc –help command. After fix this error, it will help you understand more clearly about ts CLI and also provide you with some helpful commands. Let’s go into detail.
The reason for the error “Could not resolve the path with the extensions ‘.ts’, ‘.tsx’“
The error happens when you write an invalid tsc command or write it incorrectly.
Example of how the error happens:
tsc .
The error:
The error:
error TS6231: Could not resolve the path" with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
The file is in the program because:
Root file specified for compilation
Found 1 error.
Here I get the error because I use the wrong syntax, I use “tsc . “instead of “tsc path”. This command will work:
Example:
tsc index.ts
Or I also get an error when using “tsc init “instead of “tsc –init”.
Example:
tsc init
The error:
The error:
error TS6231: Could not resolve the path" with the extensions: '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
The file is in the program because:
Root file specified for compilation
Found 1 error.
This will work:
tsc --init
The solution for this error
Beware with your command
To solve the error, you should always control the command you use and make sure that the command is valid.
Using tsc –help command
If you want to know the valid command that you can use, you can use the “tsc –help” command to see all commands and flag to work with tsc CLI.
Example:
tsc --help
Or you can read more about it here.
There are some common command lines you can use.
tsc index.ts
Emit the index.ts file with the compiler default.
This command will help you convert the index.ts file to an index.js file with meaning.
If you want to emit multiple file, you can separate files by space.
Example:
tsc index.ts test.ts
If you do not want to do it manually, you can use the –watch flag. It will watch the input file.
Example:
tsc index.ts --watch
Summary
In this article, I showed you how to solve the error “Could not resolve the path with the extensions’ .ts’, ‘.tsx’“. You should always read and know clearly about the command line before you use it. Thanks for reading!
Maybe you are interested:
- Tsc is not recognized as an internal or external command – How to solve it?
- How To Solve The Error: Object Literal May Only Specify Known Properties In TS

Hello, guys! I hope that my knowledge in HTML, CSS, JavaScript, TypeScript, NodeJS, ReactJS, MongoDB, Python, MySQL, and npm computer languages may be of use to you. I’m Brent Johnson, a software developer.
Name of the university: HOU
Major: IT
Programming Languages: HTML, CSS, JavaScript, TypeScript, NodeJS, ReactJS, MongoDB, PyThon, MySQL, npm