Welcome to the Linux Foundation Forum!

Why do the Dynamic evaluation and Debugging examples have different behaviour on Node v12.18.4 LTS?

Hello,
I see different behaviour for the Dynamic evaluation and Debugging examples in the course when run on Node.js v12.18.4 LTS.

Dynamic Evaluation

This example is from Chapter 3.
The following does not print undefined and instead prints a blank line.

$ node -p "console.log(1+1)"
2

Debugging - Adding a Breakpoint in Code

This example is from Chapter 4.
The code using debugger statement on a line does not stop at it when run using the --inspect flag.

$ node --inspect app.js

The behaviour is that it runs the same way as without the debugger statement. When run with the --inspect-brk flag it stops at the line of first execution which is the function call f() and then when stepping through the code execution stops at the debugger statement.
I tried going through the documentation but did not find anything that explains this behaviour.

The following is my machine configuration.

CentOS 8
Node.js v12.18.4

Best,
Zorawar

Categories

Upcoming Training