Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio debug error "Error processing launch: Error: Could not attach to main target

I'm working on a simple project on Codecademy and wanted to make sure I was on the right track. When I tried to debug the code, however, a simple Google page popped up and then an error reading

The error:

I'm very new to coding, so I have no idea where to start.

like image 365
DeQuawn Johnson Avatar asked Dec 23 '22 17:12

DeQuawn Johnson


2 Answers

First, you could try changing the configuration from legacy to a new one

"type": "chrome" -->   "type": "pwa-chrome"

Second increase timeout to 20 s or whatever you like

to looks like that

"configurations": [
    {
      "name": "Launch Chrome",
      "request": "launch",
      "type": "pwa-chrome",
      "timeout": 20000,
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}"
    }
like image 89
Mina Fawzy Avatar answered Jan 26 '23 01:01

Mina Fawzy


I am using the Debugger for Chrome extension and the same error occurs in version 4.12.9. In the description of the extension says:

Debugger for Chrome

Extension note description

  1. Open the settings of Visual Studio Code (Ctrl + ,) select the Workspace tab
  2. In the section Extensions -> JavaScript Debugger set option Debug > JavaScript: Use Preview to false.

How to change settings

I was also helped by installing the previous version of the Debugger for Chrome extension version 4.12.8

like image 36
Stanislav Revo Avatar answered Jan 26 '23 00:01

Stanislav Revo