Why is ts-node not compiling and executing typescript file? It is used in terminal like "ts-node scriptfile" It just returns a blank line. What is wrong? Thanks for the help.
Asked
Active
Viewed 6,899 times
6
-
I'm assuming you are using [this](https://www.npmjs.com/package/ts-node) so you should run `ts-node – EDToaster Jun 27 '19 at 22:52
-
That is exactly the way I'm using ts-node – Pyjs Jun 27 '19 at 23:10
-
Do you have a tsconfig file setup? – LJD Jun 27 '19 at 23:13
-
No tsconfig file, where and how do I set it up? But when input files are specified on the command line, tsconfig.json files are ignored anyway. – Pyjs Jun 27 '19 at 23:18
1 Answers
4
ts-node
is a typescript executor, not a compiler. If you run npx ts-node script.ts
it will execute as typescript, without compiling.
To generate a compiled js file, try tsc script.ts
.

Andrew Homeyer
- 7,937
- 5
- 33
- 26