Search code examples
reactjs.net-corevscode-debuggerlaunchjavascript-debugger

Error Debugging in VS Code: Cannot connect to the target at localhost:3000: could not find any debuggable target


I have an application with React on frontend and .Net Core on backend and i am trying to debug my react frontend, without extensions and attaching to the process, but i am getting the message error bellow:

Cannot connect to the target at localhost:3000: Could not connect to debug target at http:localhost:3000: Could not find any debuggable target.

I'm using this 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"
        }
    ]
}

I start my frontend using npm start witch is basically react-scripts start.

Obs.: Iḿ using opera browser.


Solution

  • I found a workaround. This problem only occurs when I run with sudo npm start. When running it with just npm start I got this message:

    "Unhandled exception. System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached."

    So I solved it increasing the fs.inotify.max_user_instances with this command:

    echo fs.inotify.max_user_instances=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
    

    I found this solution by the answer of @Creak . To see more details, click this link