The response from the nest
cli command from NestJS (npm i -g @nestjs/cli
) in a Docker Development container with Visual Studio Code on Windows 10 is suddenly very slow. At first it works fine but at some point, for instance after deleting a directory in the src
folder, the nest
command gets very slow.
Example:
node ➜ /workspaces/Servers/terminal-server (master ✗) $ time nest --help
[...]
real 0m44.576s
user 0m6.239s
sys 0m4.407s
Yarn is used for the package manager. NPM is used to install nest cli globally (npm i -g @nestjs/cli
):
Software | Version | Running in container | Running on W10 host |
---|---|---|---|
NPM | 8.1.2 | X | |
NodeJS | v16.13.1 | X | |
Yarn | 1.22.15 | X | |
Typescript | 4.5.2 | X | |
Nest | 8.1.6 | X | |
Visual Studio Code | 1.63.2 | X | |
Docker Desktop | 4.3.1 | X |
It looks like the line const localCommandLoader = local_binaries_1.loadLocalBinCommandLoader();
in /usr/local/share/npm-global/bin/nest
is causing the delay.
Edit: Compiling is also very slow. As you can see, it started at 8:57:20 and finished at 9:00:17. And this is compiling the default scaffolding.
[8:57:20 AM] Starting compilation in watch mode...
[8:59:43 AM] Found 0 errors. Watching for file changes.
[Nest] 5197 - 12/23/2021, 9:00:17 AM LOG [NestFactory] Starting Nest application...
[Nest] 5197 - 12/23/2021, 9:00:17 AM LOG [InstanceLoader] AppModule dependencies initialized +67ms
[Nest] 5197 - 12/23/2021, 9:00:17 AM LOG [RoutesResolver] AppController {/}: +42ms
[Nest] 5197 - 12/23/2021, 9:00:17 AM LOG [RouterExplorer] Mapped {/, GET} route +8ms
[Nest] 5197 - 12/23/2021, 9:00:17 AM LOG [NestApplication] Nest application successfully started +8ms
I did the same on WSL:
[10:03:48 AM] Starting compilation in watch mode...
[10:03:53 AM] Found 0 errors. Watching for file changes.
[Nest] 1998 - 12/23/2021, 10:03:54 AM LOG [NestFactory] Starting Nest application...
[Nest] 1998 - 12/23/2021, 10:03:54 AM LOG [InstanceLoader] AppModule dependencies initialized +62ms
[Nest] 1998 - 12/23/2021, 10:03:54 AM LOG [RoutesResolver] AppController {/}: +14ms
[Nest] 1998 - 12/23/2021, 10:03:54 AM LOG [RouterExplorer] Mapped {/, GET} route +6ms
[Nest] 1998 - 12/23/2021, 10:03:54 AM LOG [NestApplication] Nest application successfully started +9ms
For the Docker image I've selected the Node.js & TypeScript
image. Would it be better to just use a plain image and install everything manually?
Or is there a way to get the response time of nest
normal again?