diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index c636db56f0..2a647abaa7 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -2905,6 +2905,15 @@ export async function start(): Promise { InternalHooksManager.getInstance().onServerStarted(diagnosticInfo, workflow?.createdAt), ); }); + + server.on('error', (error: Error & { code: string }) => { + if (error.code === 'EADDRINUSE') { + console.log( + `n8n's port ${PORT} is already in use. Do you have another instance of n8n running already?`, + ); + process.exit(1); + } + }); } async function getExecutionsCount(