You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VPS(Ubuntu 22.04)上TypeScript编译提示“Killed”无错误求助

TypeScript编译在VPS上执行时被“Killed”的问题

我在本地机器可以正常将TypeScript的/src文件夹编译到/dist文件夹,但把代码克隆到运行Ubuntu Server 22.04的VPS上,安装npm并执行编译脚本后,运行一段时间只输出“Killed”。

执行命令示例:

$ tsc -b
Killed

我已尝试的操作:

  • npm编译脚本:"compile": "tsc",
  • tsc -b
  • tsc --diagnostics
  • tsc --watch
  • npx --max-old-space-size=250 tsc -b
  • npm编译脚本"compile": "NODE_OPTIONS='--max-old-space-size=256' tsc"
  • npx --max-old-space-size=50 tsc
  • 单文件编译tsc <filename>

所有尝试均返回“Killed”,我认为并非内存问题,而是更深层问题。

我的tsconfig.json配置:

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "outDir": "dist",
    "sourceMap": true,
    "typeRoots": ["./types", "./node_modules/@types"]
  },
  "include": ["src/**/*.ts", "tests/**/*.test.ts"],
  "exclude": ["node_modules"]
}

文件夹结构:

/node_modules
/public
/src
/tests
/views
package.json
package-lock.json
tsconfig.json

升级VPS内存会使成本翻倍,并非理想方案,请问有人遇到过类似问题吗?

内容的提问来源于stack exchange,提问作者ryandougc

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 09:40:25