Node Debug From Vagrant

debugging, node.js, remote-debugging, vagrant

Solution

Based on NodeJS 11591 issue. You can't access the Vagrant stuff via localhost (127.0.0.1), so you need to to specify host explicitly:

` $ node --inspect=0.0.0.0:9229 index.js `

Then you need to set up Target discovery settings in the Chrome. Note that `192.168.33.11` from my sample is the static IP address providing an access to the Vargant host from the local host:

Problem

Unable to remote debug a node server running on a Vagrant box in Chrome from my host machine. The server is configured to run on port 8123. Node Version: 7.10.0 In Vagrantfile: ``` config.vm.network :forwarded_port, host: 9229, guest: 9229 config.vm.network :forwarded_port, host: 8123, guest: 8123 ``` From my vagrant box I run: ``` $ node --inspect index.js Debugger listening on port 9229. Warning: This is an experimental feature and could change at any time. To start debugging, open the following URL in Chrome: chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/84085f07-dc42-4e1e-bdd8-532e6dc5c4c6 --- Customer Service--- Connecting to customer repository... Connected. Starting server... Server started successfully, running on port 8123. ``` When I try to access the url in Chrome from my host machine while I don't get an error the sources tab is empty. Screenshot of devTools

Original source