【发布时间】:2018-06-12 02:25:21
【问题描述】:
我尝试使用 VSCode 的调试“功能”来调试 React 应用程序,到目前为止,通过快速的网络搜索,我发现许多资源声称如何使用 VSCode 的 Crome 调试器来做到这一点,例如:
- https://hackernoon.com/debugging-react-like-a-champ-with-vscode-66281760037
- https://medium.com/@auchenberg/live-edit-and-debug-your-react-apps-directly-from-vs-code-without-leaving-the-editor-3da489ed905f
但我找不到使用 Firefox 的方法。到目前为止,我在 VSCode 上安装了“Debugger for firefox”,并添加了以下调试选项:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug app",
"type": "firefox",
"request": "attach"
}
]
}
我按照文档状态运行:
firefox -start-debugger-server -no-remote
我尝试通过 VSCode 初始化调试过程,但当我这样做时出现错误:
连接 ECONNREFUSED 127.0.0.1:6000
可以在我的 GNU/Linux 机器上运行以下命令确认错误
netstat -ntlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:37893 0.0.0.0:* LISTEN 9368/node
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:9333 0.0.0.0:* LISTEN 10924/code
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN -
tcp 0 0 10.42.0.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 6732/node
tcp 0 0 127.0.0.1:3001 0.0.0.0:* LISTEN 6784/mongod
tcp 0 0 0.0.0.0:3002 0.0.0.0:* LISTEN 11168/node
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:20256 0.0.0.0:* LISTEN 9368/node
tcp6 0 0 :::9090 :::* LISTEN 11340/node
tcp6 0 0 :::139 :::* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
tcp6 0 0 :::445 :::* LISTEN -
所以我想问如何在使用 react-create-app 创建并使用 firefox 通过 npm start 命令运行的 React 应用程序上使用 VSCode 的调试功能?
编辑 1
由于某些原因,当前运行的 firefox 实例出现错误:
[Parent 13358, Gecko_IOThread] WARNING: pipe error (173): Η σύνδεση έκλεισε από το ταίρι: 文件 /build/firefox-JSAO4L/firefox-57.0.3+build1/ipc/chromium/src/chrome/common/ ipc_channel_posix.cc,第 353 行
你知道为什么 firefgox 会关闭调试器吗?
【问题讨论】:
标签: reactjs debugging firefox visual-studio-code