ts-node & nodemon takes 2 minutes to start; too slow

See original GitHub issue

TL;DR Question

What I should do, to start my server in less than 1 minute?

Long-version Question

I have a Node.js server with Express (and TypeORM) that I want to run, but when I compile TypeScript it takes my every time 2 minutes to start, and it really gets annoying and moves you back in progress. I also use Nodemon to restart my server, but as you guess if it takes 2 minutes to run the server every time, Nodemon is really worthless for my case. I have searched on the internet but nothing seems to work out for me. Is there something else that I can use, or change my configuration somehow to compile faster?

Desired Behaviour To have my Node.js server start at maximum 1 minute.

Alternatives I have considered I have changed my config options in the tsconfig.json file, but nothing seems to fix the issue.

Additional context I have been using the --transpile-only flag, and it still does not compile if 2 minutes have not passed.

Thanks for taking time to answer to my question and help me. I appreciate it a lot

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:17

github_iconTop GitHub Comments

13reactions
georgekraxcommented, Jul 2, 2020

I finally used tsc -w with nodemon & concurrently, and everything seems to work as expected, but again Node.js takes also some time to start the server. However, the compilation is really fast, as tsc -w uses incremental compilation, and does not recompile everything from the start as ts-node does.

Closing as no response was given by someone

6reactions
Gvranjitcommented, Apr 6, 2022

I stumbled upon this exact same problem, and my only solution was to install and use ts-node-dev (essentially replacing nodemon). It is way faster and apparently very much optimized for ts. You might wanna give it a go if you haven’t already 😄

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Improve TypeScript App Reload Time - Bits and Pieces
One of the causes was a slow startup time — It took approximately 93 seconds to reload my app after saving changes (working...
Read more >
node.js - NestJS startup unbelievably slow in development
I've set some debug logging on various places to see what is taking up so much time, and found that my main.ts actually...
Read more >
This is why your Node.js application is slow
Blocking the event loop 🚫 Another reason your Node. js application may be performing poorly is that you could be blocking the event...
Read more >
TypeScript — Use Nodemon to Restart Your Server on Changes
You have to remove the single quotes from around "'ts-node'" for this to work. I think you might have to install ts-node globally...
Read more >
Configuring nodemon with TypeScript - LogRocket Blog
nodemon is a CLI for Node.js that makes JavaScript development much ... files with help from ts-node that requires no manual configuration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found