控制台中的日志一直显示 [12:06:59 PM] 检测到文件更改。在 nestjs 中启动增量编译

Logs in the console stuck saying [12:06:59 PM] File change detected. Starting incremental compilation in nestjs

当我启动 nest 应用程序时,它成功启动并显示下面给出的日志。

我已经使用命令 npm run dev:start 启动了项目。

[11:55:17 AM] File change detected. Starting incremental compilation...

[11:55:17 AM] Found 0 errors. Watching for file changes.

[Nest] 23860   - 05/19/2021, 11:55:18 AM   [NestFactory] Starting Nest application...
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [InstanceLoader] AppModule dependencies initialized +106ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [InstanceLoader] TypeOrmCoreModule dependencies initialized +24ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RouterExplorer] Mapped {/auth/signup, POST} route +2ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RoutesResolver] PostController {/post}: +1ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RouterExplorer] Mapped {/post/create, POST} route +0ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RouterExplorer] Mapped {/post, GET} route +1ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RoutesResolver] CategoryController {/category}: +0ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RouterExplorer] Mapped {/category/create, POST} route +0ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [NestApplication] Nest application successfully started +2ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [bootstrap] Application started at localhost:5001

现在,如果我向端点发送任何请求,它会成功发送请求,并且数据会存储在数据库中,并且还会 returns 数据,但问题是代码会被重新编译并在控制台中显示

[12:06:59 PM] File change detected. Starting incremental compilation...

并且它不显示日志消息。我该如何解决这个问题?

添加到您的 tsconfig.json:

"include": [
    "src"
]