Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么 ts-node 不编译和执行打字稿文件?它在终端中使用,如“ts-node scriptfile”它只是返回一个空行。怎么了?谢谢您的帮助。
ts-node是打字稿执行器,而不是编译器。如果您运行npx ts-node script.ts它将作为打字稿执行,无需编译。
ts-node
npx ts-node script.ts
要生成已编译的 js 文件,请尝试tsc script.ts.
tsc script.ts