Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript compiling on VPS "Killed" without error

I am trying to compile my TypeScript /src folder into the /dist folder. It works fine on my local machine, but after cloning the repo onto my VPS (Ubuntu Server 22.04), installing npm and running the compile script, it runs for a while and then just outputs "Killed"

$ tsc -b
Killed

What I've tried:

  • npm compile script: "compile": "tsc",
  • tsc -b
  • tsc --diagnostics
  • tsc --watch
  • npx --max-old-space-size=250 tsc -b
  • npm compile script "compile": "NODE_OPTIONS='--max-old-space-size=256' tsc"
  • npx --max-old-space-size=50 tsc
  • compiling a single file at a time tsc <filename>

Everything I try returns "Killed" which makes me believe its some deeper issue I have, not memory.

Here is my 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"]
}

Folder Structure

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

My only idea is to increase the memory of my VPS but that doubles my cost so isn't a very good solution.

Has anyone come across this at all?

like image 488
ryandougc Avatar asked Sep 20 '25 13:09

ryandougc


1 Answers

After Further review, I deleted all of npm and everything related to nodejs and tried re-installing it. It took probably 2 mins to install the package. I decided to upgrade my VPS to having 1GB of Memory instead of 512MB. Same CPU.

I am still interested in any options people may have to solve to issue, since it isn't actually solved. It may help other people having this issue

Here are the images of the CPU and Memory usage from my Digital Ocean droplet, memory was getting maxed out.

enter image description here

enter image description here

like image 140
ryandougc Avatar answered Sep 22 '25 11:09

ryandougc