run ts file without compiling All In One
run ts file without compiling All In One
$ npx ts-node ./app.ts
ts-node
$ yarn add -D ts-node
$ yarn add -D typescript
# Depending on the configuration, you may also need these
$ yarn add -D tslib
$ yarn add -D @types/node
https://www.npmjs.com/package/ts-node
https://github.com/TypeStrong/ts-node
https://typestrong.org/ts-node/
bugs
$ npx ts-node ./567\ permutation-in-string.ts
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/xgqfrms-mbp/Documents/GitHub/leetcode/js-solutions/567 permutation-in-string.ts
https://github.com/TypeStrong/ts-node/issues/1062
https://typestrong.org/ts-node/docs/module-type-overrides/
node & CJS
{
"type": "commonjs",
}
tsc & ESM
ts-node bug
{
"type": "module",
}
ESM vs CJS
tsconfig.json
{
"type": "module"
}
refs
https://stackoverflow.com/questions/33535879/how-to-run-typescript-files-from-command-line
https://www.educative.io/answers/how-to-execute-the-typescript-file-using-the-command-line
©xgqfrms 2012-2025
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/16559320.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
2021-08-07 国内注册的域名突然无法访问 All In One
2020-08-07 我自成佛自度我,佛度凡尘我度佛 All In One
2020-08-07 You Don't Know Chrome Features
2019-08-07 flutter & startup lock & bug
2019-08-07 flutter & chat app & github
2018-08-07 Linux & bash & shell & PID & PPID
2016-08-07 如何在 Python 中使用 UTF-8 编码 All In One