From 9192ac442077da9eb0ab0cb079f845024ac49850 Mon Sep 17 00:00:00 2001 From: forehalo Date: Wed, 14 Aug 2024 13:41:23 +0000 Subject: [PATCH] fix(server): command line nestjs does not have http adapter (#7876) --- packages/backend/server/src/core/selfhost/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/backend/server/src/core/selfhost/index.ts b/packages/backend/server/src/core/selfhost/index.ts index 58a780d170..0c559767e8 100644 --- a/packages/backend/server/src/core/selfhost/index.ts +++ b/packages/backend/server/src/core/selfhost/index.ts @@ -60,6 +60,11 @@ export class SelfhostModule implements OnModuleInit { onModuleInit() { const staticPath = join(this.config.projectRoot, 'static'); + // in command line mode + if (!this.adapterHost.httpAdapter) { + return; + } + const app = this.adapterHost.httpAdapter.getInstance(); const basePath = this.config.server.path;