reactjs - 在 VS Code 中调试错误 : Cannot connect to the target at localhost:3000: could not find any debuggable target

标签 reactjs .net-core vscode-debugger launch javascript-debugger

我有一个在前端使用 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/

相关文章:

javascript - 通过在其外部点击来模糊 <TextInput/>,在 native react 中不起作用

c# - Entity Framework core 2.0.3 未提供数据库中的最新数据

javascript - 我们如何从 js Map 对象中删除特定对象?

javascript - 如何使用 react.js 中的 WHERE 查询计算 Firebase Firestore 中集合中的文档数

asp.net-core - ASP .Net Core 谷歌身份验证

c# - 在 C# 的 StackExchange.Redis 中将什么用作 asyncState 对象(或从哪里获取它)

python - 调试期间 VSCode python 'Unverified breakpoint'?

python - 为什么我的 launch.json 上会出现 “Property pythonPath is not allowed”?

python - Docker hyperkit 进程 CPU 使用率变得疯狂。如何控制它?

javascript - .env 变量在 React JS 应用程序中返回未定义