[英]VSC Debugger does not attach to node.js on RPi
I'm trying to set up VSC on a Macbook to remote debug nodejs on a Raspberry Pi.我正在尝试在 Macbook 上设置 VSC 以在 Raspberry Pi 上远程调试 nodejs。 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. Node 在 Pi 上与 Inspector (
--inspect-brk
) 一起运行,似乎有一些连接,但 .js 文件既没有打开,编辑器也没有跳到第一行。 I followed this instruction: https://github.com/BretStateham/pinodevscode I googled 3 evenings already without success.我按照以下说明进行操作: https : //github.com/BretStateham/pinodevscode我用谷歌搜索了 3 个晚上都没有成功。 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).
为了检查,如果远程调试通常有效,我已经设置了一个远程调试配置,该配置附加到我的 Macbook 上的 nodejs(这就像一个魅力)。 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.
当我尝试对 RPi 做完全相同的事情时(所以我基本上在配置中放置了不同的 IP 地址和 RemoteRoot),它不再起作用。
Here's what I did so far in the Pi setup:这是我目前在 Pi 设置中所做的:
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 Macnode -inspect-brk:192.168.178.42:9229 app.js
,它报告检查器正在侦听端口,当我从 Mac 扫描时,我可以看到端口打开My configuration in launch.json
:我在
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.远程设置的 Runtime.launch 标签。 (the port is included in the URL)
(端口包含在 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.本地设置的 Runtime.launch 标签。 (the port is not included in the URL)
(端口不包含在 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
.nodejs -v
验证了正确的安装,但 bash 在默认别名node
。--inspect-brk
should work, but obviously, for some reason it does not anymore with my setup. --inspect-brk
远程调试应该可以工作,但显然,由于某种原因,我的设置不再适用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.