Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error not showing in stderr with node --inspect-brk in node 12+ #41792

Open
eliba2 opened this issue Aug 15, 2020 · 1 comment · May be fixed by #42486
Open

Syntax error not showing in stderr with node --inspect-brk in node 12+ #41792

eliba2 opened this issue Aug 15, 2020 · 1 comment · May be fixed by #42486
Labels
inspector Issues and PRs related to the V8 inspector protocol

Comments

@eliba2
Copy link

eliba2 commented Aug 15, 2020

HI,
I'm trying a simple script with a syntax error in it but I'm not getting the error displayed when running with node versions 12+. Older versions are ok. I've tried this script (in test.js):

console.log(1)
console.log(2
console.log(3)

When running with node 11, I'm seeing the error:

# node-inspect test.js
< Debugger listening on ws://127.0.0.1:9229/9f22bef2-a0db-4c2d-89d6-f741e1f3c9cd
< For help, see: https://nodejs.org/en/docs/inspector
< Debugger attached.
< /test.js:2
< console.log(1
<             ^
< SyntaxError: missing ) after argument list
<     at Module._compile (internal/modules/cjs/loader.js:760:23)
<     at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
<     at Module.load (internal/modules/cjs/loader.js:685:32)
<     at Function.Module._load (internal/modules/cjs/loader.js:620:12)
<     at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
<     at internal/main/run_main_module.js:21:11
< Waiting for the debugger to disconnect...
debug>

But with node 12+ (tried 13,14) the error is not echoed in the terminal and I'm getting:

/ # node-inspect test.js
< Debugger listening on ws://127.0.0.1:9229/583b30fe-ab2d-43f9-af41-a23d0148c985
< For help, see: https://nodejs.org/en/docs/inspector
< Debugger attached.
< Waiting for the debugger to disconnect...
debug>

I would like to get the error echoed in the terminal. Is this a valid output or I'm doing anything wrong?
Thanks-

@jkrems jkrems changed the title Syntax error not showing in node 12+ Syntax error not showing in node inspect in node 12+ Jan 31, 2022
@jkrems
Copy link
Contributor

jkrems commented Jan 31, 2022

This also reproduces with node --inspect-brk. The difference is that there the console API is forwarded to the DevTools. But in the terminal, the error is silently omitted.

I think swallowing the stderr output when attaching a remote debugger is likely a bug and worth fixing.

@jkrems jkrems changed the title Syntax error not showing in node inspect in node 12+ Syntax error not showing in stderr with node --inspect-brk in node 12+ Jan 31, 2022
@jkrems jkrems transferred this issue from nodejs/node-inspect Jan 31, 2022
@jkrems jkrems added the inspector Issues and PRs related to the V8 inspector protocol label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants