skip to Main Content

Is it just me, or Chromium DevTools stopped to stop at breakpoints in node_modules (including /usr/lib/node_modules)?

a.js:

console.log('a.js');
require('./b');

b.js:

debugger
console.log('b.js');
require('userhome');
$ npm i [email protected]
// add the following lines to node_modules/userhome/index.js:
// debugger
// console.log('userhome');
$ node --inspect-brk a.js

Open about:inspect in Chromium. Choose the process under Remote Target. Press F8. It stops at b.js. Press F8 again. It doesn’t stop at node_modules/userhome/index.js and finishes.

Am I missing something? Is there a way to debug this issue somehow (a way to figure out why it doesn’t stop at node_modules breakpoints)?

I’m running Chromium 121.0.6167.184 and nodejs v21.6.1.

UPD I just checked on another machine with Chromium 115.0.5790.102 and v20.4.0, and here it works. It had the Node.js V8 –inspector Manager (NiM) extension installed, but I turned it off before testing.

It looks as if node_modules is considered "uninteresting" in the recent versions of Chromium (and likely Chrome), and as such skipped. I’d like to disable it somehow.

2

Answers


  1. Chosen as BEST ANSWER

    The workaround I've found is... to not use Chromium DevTools. You can debug code with vscode:

    • Launch it
    • Ctrl-Shift-P
    • Choose Debug: Attach to Node Process
    • Choose the node --inspect process

    The trick is, you can't debug processes running under root, as might be the case with processes running in docker containers.

    UPD With the help of the lscr.io/linuxserver/chromium image I was able to figure out that it stopped working in Chromium around 120:

    // 119.0.6045.159 +
    $ docker run --rm --network=host 
      lscr.io/linuxserver/chromium:5098d7ca-ls46
    
    // 120.0.6099.129 -
    $ docker run --rm --network=host 
      lscr.io/linuxserver/chromium:4fed82c2-ls47
    

    And I soon was able to find in What's new that they added node_modules to the ignore list.


  2. This is a new feature in Chrome 120, it does "now skip scripts from /node_modules/ and /bower_components/ by default.".

    You can turn this off, or remove individual modules from that list, in the Ingore List settings of the devtools.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search