Closed Cpt-Falcon closed 10 months ago
Good news, here is the workaround to get things to work:
yarn nx serve my-app --host=127.0.0.1
The key is to set the host to 127.0.0.1. Localhost will not work for some reason. Why? Don't know. Then in your launch.json make sure to set the uri to 127.0.0.1 instead of localhost.
Bump
Unfortunately this is not working for me on 15.9.2 when I am trying to debug a nest application. The issue seems to be related to the path where source files are vs. where they run from:
I have no idea how to adjust the build tool (nx) to correct the path ... Launch configuration is plain and simple:
{
"type": "node",
"request": "attach",
"name": "Api attach",
"port":9229,
}
Grateful for any suggestion!
@pmosconi Did you try changing the host to 127.0.0.1? That worked for me as a workaround, but not sure about next js
same issue https://github.com/nrwl/nx/issues/15159
@Cpt-Falcon: I tried changing to 127.0.0.1 but no luck. I'm using nest.js (typescript APIs).
@tonivj5 Yes its the same issue but it was claimed to be fixed in more recent versions, which it is not.
@Cpt-Falcon It appears you're dealing with a separate issue from the NestJS debugging problem. I assume you're trying to debug a frontend application? If so, your workaround is the right solution for getting breakpoints working for your FE application. See here for more details on your problem.
For the separate issue of Nx NestJS users, I can confirm that it appears that VSCode debugging is indeed broken OOTB with Nx 15.x.x.
Hi I have the same problem on 16.0.3 version.
I suspect the problem is within the path file, in particular with the 'packages' string in the path.
If I attach the debug with chrome, vsc's debug open the file, where I've put the my breakpoints, without 'packages'
Es: '~/dev/projectname/src/routes/myfile.ts'
While the real file is in ~/dev/projectname/src/packages/routes/myfile.ts'
And, I don't know if is there a correlation, but the nx console have some problem with generate angular component... I always have to add 'packages' string to the start of the property 'path' otherwise nx console complain
I hope this help to fix those problems. thx
breakpoints for nest.js also not working with 16.1.4
I got this working on localhost
by updating my project.json
to include host
in the serve
options. Thanks to @pmosconi for their comment that put me on the right track.
// launch.json
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:4200",
"preLaunchTask": "npm: serve:web",
},
// project.json
{
"name": "web",
"targets": {
"build": {...},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"sourceMap": {
"scripts": true,
"styles": true,
"vendor": true
},
"options": {
"browserTarget": "web:build",
"host": "localhost", // added this
"port": 4200
},
},
...
}
Hi guys,
The debugger didn't break on breakpoints I set (only with debugger;
) and I've figured our the root cause for me - might help others as well:
https://github.com/nestjs/swagger/issues/2496
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
!!IMPORTANT EDIT!!
Good news, here is the workaround to get things to work:
yarn nx serve my-app --host=127.0.0.1
The key is to set the host to 127.0.0.1. Localhost will not work for some reason. Why? Don't know. Then in your launch.json make sure to set the uri to 127.0.0.1 instead of localhost.
Edit: Example repo of breakpoint failure on fresh project using create workspace:
https://github.com/Cpt-Falcon/NxBreakpointFailure
Current Behavior
Breakpoints don't bind and therefore are not hit. Breakpoints do get hit if you go into the browser inspector and set a breakpoint there, but not through vs code code. Here's vs code running in debug, and you can see on the sidebar that the breakpoints are not bound.
See this other issue which was supposedly resolved with a recent pr:
https://github.com/nrwl/nx/issues/14708#issuecomment-1457996600
I have tried a variety of things as well:
Launch config web root
Project.json source map on/off, vendor chunk on/off combination
webpack config json hack, doesn't work for me:
Also The browser takes forever to startup too when a breakpoint is set.
Expected Behavior
Breakpoints should bind.
GitHub Repo
https://github.com/Cpt-Falcon/NxBreakpointFailure
Steps to Reproduce
Nx Report
Failure Logs
No response
Additional Information
No response