Reputation: 586
When I try to set a breakpoint and debug the file, the debugger just run the app without stopping at breakpoints. This is my code:
console.log('123');
And this is my output:
/usr/bin/node --debug-brk=39765 --nolazy index.js
debugger listening on port 39765
123
Process finished with exit code 0
Does anyone has an idea what could be the problem?
Upvotes: 28
Views: 28820
Reputation: 463
I don't know if that will help somebody, But I was facing the same problems in my configuration. I have Node.js application written in TypeScript (the API server). My mistake was to start the application using my start script:
I was trying to use debugger build in WebStorm and default configuration:
The mistake was that debugger couldn't connect to that kind of process. So I changed the configuration to run my second script that builds all sources first and uses node.js to run the index.js, take a look.
The script from package.json:
And the configuration:
Now debugging works like a charm!
Upvotes: 1
Reputation: 4102
I had an auto-executed function that was imported by my React component (<View/>
), and that component was imported by the test, making it fail to stop on breakpoints on all test cases regardless or their content.
// culprit
export const shaderRowLimit = (() => {
const report = isCI() ? {MAX_FRAGMENT_UNIFORM_VECTORS: 1024, MAX_TEXTURE_SIZE: 16384} : get_webGL_report();
return getPyramidRowLimit(
report.MAX_TEXTURE_SIZE * report.MAX_TEXTURE_SIZE,
-15,
)
})();
The error shown in the test was unrelated, as it looked like a css selector not finding his target, the real error seems to have been Error creating WebGL context.
coming from get_webGL_report
function. It is supposed to be mocked... but maybe it is executed before Jest is able to intercept it.
I coded this stuff like a year ago, breakpoints might have been working before, or not.
All of this made it quite hard to debug. To find the issue: Make a most simple test file (with only one test case inside), check if it work with breakpoints in your projects, start gradually adding more stuff from the test that doesn't stop on breakpoints. Or work the other way, gradually removing stuff.
I also update my IDE to latest version just in case.
Edit: there seems to be another issue, importing <App/>
, that contains <View/>
in the same file seems to make breakpoint being skipped.
Upvotes: 0
Reputation: 669
I'm having the same issue in version 2022.2 but I don't think it is a problem with the version
Here are the potential solutions;
Go to;
WebStorm -> Preference -> Build, Execution, Deployment -> Debugger
Click "Allow unsigned requests
" checkbox and make it checked
This solved my issue.
Or
Check your local environment. What I mean by saying check your local environment is usually more than one service is trying to use the same debugger port if we speak about the e.g. nodejs.
You will get the following message if you try to run two services at the same time in the debug mode;
Starting inspector on 127.0.0.1:9229 failed: address already in use
Try to start the main service first that you try to debug.
Upvotes: 1
Reputation: 1139
disabling js.debugger.use.node.options
in the webstorm registry helped me
https://youtrack.jetbrains.com/issue/WEB-47774#focus=Comments-27-4436526.0-0
Upvotes: 4
Reputation: 334
Fixed the issue by enabling generation of 'map' file in the TypeScript configuration. Add '--sourceMap' in Tools-->Languages & Frameworks-->TypeScript-->Options
Upvotes: 1
Reputation: 18627
For me the issue was that WebStorm didn't play well with my typescripts. It would say debugger listening and then run through the entire program without stopping at the breakpoint as described in the question.
The workaround I used was to simply put the breakpoint in compiled js file and debug from there instead.
Upvotes: 3
Reputation: 795
Debug breakpoints not work in my PhpStorm 2016.3.2 with NodeJS 7.7.x. My expectation is, that WebStorm will have same issue.
If you downgrade to Node 6 (I tested with 6.9.4), it starts working correctly.
Upvotes: 2
Reputation: 1188
Wanted to chime in and say that it is absolutely critical that you use --debug-brk
and not --debug
with getting WebStorm breakpoints to work for remote debugging as well as running the server directly from webstorm.
Even though --debug-brk
technically just stops and waits for the debugger to join, and --debug
allows you to join later, my breakpoints failed with just --debug
no matter the remote configuration I tried.
As far as I can tell, connecting WebStorm 11 to a node.js server on the debug port, with only --debug
, will connect but fail to load any breakpoints that work.
Upvotes: 6
Reputation: 588
Try to disable js.debugger.v8.use.any.breakpoint in WebStorm registry.
You can do it by going to Help -> Find Action
In there just enter Registry.
For me disabling this option made debugging anything node-related much faster and much more predictable.
Upvotes: 17
Reputation:
Run -> View Breakpoints...
or hit
shift+command+F8 in OS X.Suspend
is checked.Upvotes: 1