Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungRefreshed repository pull requests page generally available(22.09.2026 um 03:25 Uhr)
Sichere ProgrammierungThe Joy of Learning the Basics Again(22.09.2026 um 03:28 Uhr)
Sichere ProgrammierungZero-Code OpenTelemetry Tracing for Dagster(22.09.2026 um 03:39 Uhr)
Linux Tipps & Hardening`prime-all`(22.09.2026 um 02:28 Uhr)
IT Security Toolsopensoho v0.15.2(22.09.2026 um 03:33 Uhr)
IT Security NachrichtenUS Proposes AI Incident Alert System in Talks With China, Bessent Says(22.09.2026 um 04:01 Uhr)
Sichere ProgrammierungRefreshed repository pull requests page generally available(22.09.2026 um 03:25 Uhr)
Sichere ProgrammierungThe Joy of Learning the Basics Again(22.09.2026 um 03:28 Uhr)
Sichere ProgrammierungZero-Code OpenTelemetry Tracing for Dagster(22.09.2026 um 03:39 Uhr)
Linux Tipps & Hardening`prime-all`(22.09.2026 um 02:28 Uhr)
IT Security Toolsopensoho v0.15.2(22.09.2026 um 03:33 Uhr)
IT Security NachrichtenUS Proposes AI Incident Alert System in Talks With China, Bessent Says(22.09.2026 um 04:01 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

How to Fix Nodemon Not Restarting (Stuck on Old Code) with Turso / libSQL

If you're building a Node.js / Express app using Turso (@libsql/client) and notice that nodemon isn't updating your newly added routes, you might have run into a very common development trap! You might see things like: Cannot GET…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

If you're building a Node.js / Express app using Turso (@libsql/client) and notice that nodemon isn't updating your newly added routes, you might have run into a very common development trap!



You might see things like:





  • Cannot GET /new-route even though you just wrote the code for it.


  • EADDRINUSE: address already in use :::3000 hiding in your terminal logs.






🐛 What is happening?



To make queries fast, the @libsql/client holds a persistent, open socket connection to your Turso database.

Because Node.js is designed to never exit as long as there is an active background process (like a database connection), whenever nodemon tries to restart your app, the old process refuses to die.



The old process becomes a "zombie" that keeps running on Port 3000, preventing your updated code from taking over the port.





🛠️ The Solution: Graceful Shutdown



To fix this, you don't need a new package. You just need to tell your Node.js app to close the database connection whenever nodemon sends the restart signal (SIGUSR2).





Step 1: Export your server instance



Modify your app.listen so you have a reference to the running server.




const PORT = process.env.PORT || 3000;

// Change this:
// app.listen(PORT, () => console.log('Running...'))

// To this:
const server = app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});









Step 2: Add the Graceful Shutdown Logic



At the very bottom of your server.ts (or index.ts), add this cleanup code. It listens for termination signals, closes the database connection, shuts down Express, and finally exits the process.




import { tursoClient } from "./config/turso.js"; // Import your DB client

const shutdown = async () => {
console.log("Shutting down gracefully...");

// 1. Close your database connections
// If using Turso:
tursoClient.close();

// 2. Shut down the express server
server.close(() => {
// 3. Exit the process successfully so nodemon can restart
process.exit(0);
});
};

// Handle Ctrl+C (Terminal Quit)
process.on("SIGINT", shutdown);

// Handle System or Docker shut down
process.on("SIGTERM", shutdown);

// Handle Nodemon restarts
process.once("SIGUSR2", async () => {
await shutdown();
});









Step 3: Clear any lingering Zombie Processes



If you've been experiencing this bug, you likely have hidden processes still holding your port.



If you are on Windows, run this in PowerShell:




npx kill-port 3000






On Mac/Linux, run:




killall node






Now, run npm run dev again. Every time you save your file, nodemon will cleanly shut down the old server and start the new one instantly! Happy coding! 🚀

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Fix Nodemon Not Restarting (Stuck on Old Code) with Turso / libSQL

Thematisch verwandte Begriffe: Nodemon, Restarting, Stuck, Code · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-61647 | NotebookLM MCP is an MCP server and HTTP service for interacting with Go…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick