我有一个在前端使用 React 并在后端使用 .Net Core 的应用程序,我正在尝试调试我的 React 前端,没有扩展并附加到进程,但我收到以下消息错误:
Cannot connect to the target at localhost:3000: Could not connect to debug target at http:localhost:3000: Could not find any debuggable target.
我正在使用这个 launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug FrontEnd",
"port": 3000,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}"
},
{
"name": "Debug BackEnd",
"type": "coreclr",
"request": "attach"
}
]
}
我使用 npm start
开始我的前端,基本上是 react-scripts start
。
观察:我使用 Opera 浏览器。
最佳答案
我找到了解决方法。
只有当我使用 sudo npm start
运行时才会出现此问题。
当仅使用 npm start
运行它时,我收到了这条消息:
“未处理的异常。System.IO.IOException:已达到 inotify 实例数量的配置用户限制 (128),或者已达到打开文件描述符数量的每个进程限制。 "
所以我用这个命令解决了增加 fs.inotify.max_user_instances 的问题:
echo fs.inotify.max_user_instances=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
我通过@Creak 的回答找到了这个解决方案。要查看更多详细信息,请单击 this link
关于reactjs - 在 VS Code 中调试错误 : Cannot connect to the target at localhost:3000: could not find any debuggable target,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72917137/