I run this:
$ node inspect cypress/support/reset-fixture.js teardown
In that file I have a call to a place where there is a debugger;
statement.
I type c
to continue to that place.
Once I get there, I type repl
and in the repl I type require
.
I get an error saying that in that place there is no require
: ReferenceError: require is not defined
.
The terminal session is below:
/m/s/S/L/T/volto-slate-project > node inspect cypress/support/reset-fixture.js teardown
< Debugger listening on ws://127.0.0.1:9229/0b6b3784-8e0c-4c35-8baa-46ea102b4bfa
< For help, see: https://nodejs.org/en/docs/inspector
< Debugger attached.
Break on start in cypress/support/reset-fixture.js:1
> 1 const xmlrpc = require('xmlrpc');
2
3 // const args = process.argv;
debug> c
break in node_modules/xmlrpc/lib/client.js:119
117
118 if (response.statusCode == 404) {
>119 debugger;
120 callback(__enrichError(new Error('Not Found')))
121 }
debug> repl
Press Ctrl + C to leave debug repl
> require
ReferenceError: require is not defined
at eval (eval at <anonymous> (/media/silviu/Samsung_T5/Lucru/Tibi/volto-slate-project/node_modules/xmlrpc/lib/client.js:119:7), <anonymous>:1:1)
at Client.<anonymous> (/media/silviu/Samsung_T5/Lucru/Tibi/volto-slate-project/node_modules/xmlrpc/lib/client.js:119:7)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:315:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
at Socket.socketOnData (_http_client.js:469:22)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
If I do not type c
in the above-presented session, require
seems to exist and can be used.
How can I use require after that c
?
I use this Node version: v12.18.0.
Thank you.
I have posted an answer, but further explanation would help. A more detailed answer that explains how things work behind the scenes would be very nice.
If I put this line:
console.dir(require);
before the line:
debugger;
then when the debugger;
line is hit, in the repl
of the Node debugger the require
function is defined well.