Typescript compiler hangs forever

I have a pretty small typescript app (few files). Everything works and compiles locally. However, whenever I try to do it on my droplet, the tsc script hangs forever.

I ran the build with --verbose flag and here’s the output. Does anyone know why the tsc command hang forever?

root@jcm-v2:/var/www/html/jcm-api-v2# tsc --verbose
error TS5093: Compiler option '--verbose' may only be used with '--build'.
root@jcm-v2:/var/www/html/jcm-api-v2# npm run build --verbose
npm verb cli /usr/bin/node /usr/bin/npm
npm info using npm@8.18.0
npm info using node@v18.7.0
npm timing npm:load:whichnode Completed in 0ms
npm timing config:load:defaults Completed in 5ms
npm timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 7ms
npm timing config:load:builtin Completed in 7ms
npm timing config:load:cli Completed in 5ms
npm timing config:load:env Completed in 1ms
npm timing config:load:file:/var/www/html/jcm-api-v2/.npmrc Completed in 1ms
npm timing config:load:project Completed in 7ms
npm timing config:load:file:/root/.npmrc Completed in 0ms
npm timing config:load:user Completed in 2ms
npm timing config:load:file:/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 1ms
npm timing config:load:credentials Completed in 3ms
npm timing config:load:setEnvs Completed in 2ms
npm timing config:load Completed in 35ms
npm timing npm:load:configload Completed in 36ms
npm timing npm:load:mkdirpcache Completed in 2ms
npm timing npm:load:mkdirplogs Completed in 2ms
npm verb title npm run build
npm verb argv "run" "build" "--loglevel" "verbose"
npm timing npm:load:setTitle Completed in 4ms
npm timing config:load:flatten Completed in 7ms
npm timing npm:load:display Completed in 30ms
npm verb logfile logs-max:10 dir:/root/.npm/_logs
npm verb logfile /root/.npm/_logs/2023-03-07T03_47_00_121Z-debug-0.log
npm timing npm:load:logFile Completed in 20ms
npm timing npm:load:timers Completed in 0ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 101ms
(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠼ : timing npm:load Completed in 101ms
> jcm-api@1.0.0 build
> tsc

npm timing command:run Completed in 2000263ms
npm verb exit 0
npm timing npm Completed in 2000414ms
npm info ok

Thanks in advance!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 7, 2023
Accepted Answer

Hi there,

What version of tsc are you using?

I’ve seen a similar problem in the past as described here:

The problem was sorted out after an upgrade from v4.4 to v4.6.


It turned out that it was a memory problem, adding more memory or a swap file fixed the problem. This was figured out by the following steps:

  • Open two terminal windows and in the first one run the htop command and monitor your server resource utilization, in the second one run the tsc command.

  • In case that you are running low on memory, I would recommend adding a swap file so that you could have some extra buffer:

  • Alternatively adding more memory to the Droplet would also have helped.



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel