I'm trying to set up VSC on a Macbook to remote debug nodejs on a Raspberry Pi.
Node is running with Inspector (--inspect-brk
) on the Pi and there seems to be some connection, but neither the .js file is opened nor is the editor jumping to the first line.
I followed this instruction: https://github.com/BretStateham/pinodevscode
I googled 3 evenings already without success. For checking, if remote debugging generally works, I have set up a remote debugging configuration that attaches to nodejs on my Macbook (this works like a charm). When I try to do exactly the same thing with the RPi (so I basically put a different IP address and RemoteRoot in the config) it does no longer work.
Here's what I did so far in the Pi setup:
node -inspect-brk:192.168.178.42:9229 app.js
, it reports that inspector is listening on the port and I can see the port open, when I scan from the MacMy configuration in launch.json
:
"address": "192.168.178.42",
"localRoot": "${workspaceFolder}",
"name": "Attach to Remote",
"trace": true,
"port": 9229,
"remoteRoot": "/home/user/MYCODE",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
Runtime.launch tag of the remote setup. (the port is included in the URL)
{
"tag": "runtime.launch",
"timestamp": 1603657311615,
"message": "Discovered target URL from /json/list",
"metadata": {
"url": "ws://192.168.178.42:9229/c403f26a-422c-4a79-aa59-30b108cc0b51",
"fixed": "ws://192.168.178.42:9229/c403f26a-422c-4a79-aa59-30b108cc0b51"
},
"level": 0
}
Runtime.launch tag of the local setup. (the port is not included in the URL)
{
"tag": "runtime.launch",
"timestamp": 1603655650439,
"message": "Discovered target URL from /json/list",
"metadata": {
"url": "ws://localhost/94b1ced4-4eb9-4ca6-a710-c175393f6220",
"fixed": "ws://localhost:9229/94b1ced4-4eb9-4ca6-a710-c175393f6220"
},
"level": 0
}
Could that be the problem?
Finally figured out a potential root cause and solution (I post it here, in case anybody else has a similar problem):
nodejs -v
, the bash still had the system version node 8 under the default alias node
.--inspect-brk
should work, but obviously, for some reason it does not anymore with my setup.