8

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.

4
  • I'm assuming you are using this so you should run ts-node <script> Commented Jun 27, 2019 at 22:52
  • That is exactly the way I'm using ts-node <script> Commented Jun 27, 2019 at 23:10
  • Do you have a tsconfig file setup? Commented Jun 27, 2019 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. Commented Jun 27, 2019 at 23:18

1 Answer 1

8

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.

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

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.