安装
ts-node 需要在全局去安装。这里要用 npm 去全局安装,yarn 全局安装好像用不了 ts-node
全局安装:
npm install -g typescript npm install -g ts-node
本地安装:用npx ts-node 程序名
npm install typescript npm install ts-node
简单程序:test.ts
const output = "Hello world"
console.log(output)
执行:
ts-node test.ts
这篇博客介绍了如何通过npm全局和本地安装ts-node,并提供了简单的TypeScript程序示例。全局安装ts-node需运行'npm install -g typescript ts-node',而本地安装则使用'npx ts-node 程序名'。示例程序打印'Hello world',执行命令为'ts-node test.ts'。
6810

被折叠的 条评论
为什么被折叠?



