Is there an existing issue for this?
Current behavior
$ nest new project-name && cd project-name && yarn
$ npx nest start --watch -b swc
The output log info is here, Nest application successfully will be output twice because process has been created twice.
SWC Running...
Successfully compiled: 5 files with swc (27.22ms)
childProcessRef null
(node:61503) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use node --trace-deprecation ... to show where the warning was created)
Watching for file changes.
[Nest] 61509 - 2025/07/30 17:16:04 LOG [NestFactory] Starting Nest application...
[Nest] 61509 - 2025/07/30 17:16:04 LOG [InstanceLoader] AppModule dependencies initialized +3ms
[Nest] 61509 - 2025/07/30 17:16:04 LOG [RoutesResolver] AppController {/}: +1ms
[Nest] 61509 - 2025/07/30 17:16:04 LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 61509 - 2025/07/30 17:16:04 LOG [NestApplication] Nest application successfully started +0ms
[Nest] 61535 - 2025/07/30 17:16:04 LOG [NestFactory] Starting Nest application...
[Nest] 61535 - 2025/07/30 17:16:04 LOG [InstanceLoader] AppModule dependencies initialized +3ms
[Nest] 61535 - 2025/07/30 17:16:04 LOG [RoutesResolver] AppController {/}: +1ms
[Nest] 61535 - 2025/07/30 17:16:04 LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 61535 - 2025/07/30 17:16:04 LOG [NestApplication] Nest application successfully started +1ms
Minimum reproduction code
Use offical default example
Steps to reproduce
$ nest new project-name && cd project-name && yarn
$ npx nest start --watch -b swc
Expected behavior
I hope the NestJS application should start once.
Package version
^11.0.0
NestJS version
^11.0.0
Node.js version
24
In which operating systems have you tested?
Other
The logic is here https://github.com/nestjs/nest-cli/blob/master/lib/compiler/swc/swc-compiler.ts#L60
OnSuccess will be called twice when first running. In my opinion, watchFilesInOutDir method should be executed after the first Nest start application finishes? So, we need to add childProcess as a return value in theonSucess method.
If we can reach a consensus, I'll be happy to send a pull request to fix it.
Is there an existing issue for this?
Current behavior
The output log info is here,
Nest application successfullywill be output twice because process has been created twice.Minimum reproduction code
Use offical default example
Steps to reproduce
Expected behavior
I hope the NestJS application should start once.
Package version
^11.0.0
NestJS version
^11.0.0
Node.js version
24
In which operating systems have you tested?
Other
The logic is here https://github.com/nestjs/nest-cli/blob/master/lib/compiler/swc/swc-compiler.ts#L60
OnSuccesswill be called twice when first running. In my opinion,watchFilesInOutDirmethod should be executed after the firstNest start applicationfinishes? So, we need to add childProcess as a return value in theonSucessmethod.If we can reach a consensus, I'll be happy to send a pull request to fix it.