I use NestJS for my backend and I develop under WebStorm with the NX plugin. Everything is up to date.
If I create a new NestJS project like this
npm i -g @nestjs/cli
nest new project-name
I can launch it, put a breakpoint and debug it under WebStorm
But if I create it via nx
like this :
npx create-nx-workspace my-workspace --preset=nest
And launch it in debug mode via the NX plugin :
I get an error at runtime :
/home/adenoyelle/_TEMP/yolo/my-workspace/node_modules/.bin/nx run my-workspace:serve
Debugger listening on ws://127.0.0.1:40311/08cd50f9-321b-4a5e-a65d-5a2cc325ce03
For help, see: https://nodejs.org/en/docs/inspector
error: unrecognized subcommand '/home/adenoyelle/tools/WebStorm-233.11799.31/plugins/javascript-debugger/debugConnectorPortPublisher.js'
Usage: deno [OPTIONS] [COMMAND]
For more information, try '--help'.
It seems that it is trying to execute deno
(a TypeScript interpreter) and fails with the debugging options. The project is still launched but the debugger is not attached, making the breakpoints useless.
Maybe the problem is that it should not try to use deno
, but if I rename the ~/.deno
folder to ~/.deno.bak
folder, it fails because it does not find deno
/home/adenoyelle/_TEMP/yolo/my-workspace/node_modules/.bin/nx run my-workspace:serve
Debugger listening on ws://127.0.0.1:39697/fad61f36-b090-4d4e-a3a2-9c2147eb6dec
For help, see: https://nodejs.org/en/docs/inspector
[debugConnector] Attaching debugger skipped (unhandled exception) <ref *1> Error: spawnSync /home/adenoyelle/.deno/bin/deno ENOENT
So far, I don’t understand if the problem comes from nest, nx, the nx plugin for WebStorm, or WebStorm.
Is there a way that allows me to launch the project in debug mode ?