microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 282 forks source link

Error processing launch: Error: Could not attach to main target... #685

Closed MuTsunTsai closed 4 years ago

MuTsunTsai commented 4 years ago

I'm seeing the following error message when launching:

image

This error only appear with the latest version; everything works fine with version 4.12.8. My config:

{
    "type": "chrome",
    "request": "launch",
    "name": "Launch in Chrome",
    "preLaunchTask": "Gulp build",
    "file": "${workspaceFolder}/dist/index.htm",
    "sourceMaps": true
},
{"timestamp":1596546003896,"tag":"runtime.welcome","level":1,"message":"js-debug v1.47.5 started","metadata":{"os":"win32 x64","nodeVersion":"v12.8.1","adapterVersion":"1.47.5"}}
{"tag":"dap.receive","timestamp":1596546003882,"metadata":{"connectionId":1,"message":{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"pwa-chrome","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"zh-tw","supportsProgressReporting":true},"type":"request","seq":1}},"level":0}
{"tag":"dap.send","timestamp":1596546003882,"metadata":{"connectionId":1,"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"caught","label":"Caught Exceptions","default":false},{"filter":"uncaught","label":"Uncaught Exceptions","default":false}],"supportsStepBack":false,"supportsSetVariable":true,"supportsRestartFrame":true,"supportsGotoTargetsRequest":false,"supportsStepInTargetsRequest":false,"supportsCompletionsRequest":true,"supportsModulesRequest":false,"additionalModuleColumns":[],"supportedChecksumAlgorithms":[],"supportsRestartRequest":true,"supportsExceptionOptions":false,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":true,"supportsLoadedSourcesRequest":true,"supportsLogPoints":true,"supportsTerminateThreadsRequest":false,"supportsSetExpression":false,"supportsTerminateRequest":false,"completionTriggerCharacters":[".","[","\"","'"],"supportsBreakpointLocationsRequest":true,"supportsClipboardContext":true}}},"level":0}
{"tag":"dap.send","timestamp":1596546003882,"metadata":{"connectionId":1,"message":{"seq":2,"type":"event","event":"initialized","body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1596546003890,"metadata":{"connectionId":1,"message":{"command":"launch","arguments":{"type":"pwa-chrome","request":"launch","name":"Launch in Chrome","preLaunchTask":"Gulp build","file":"C:\\Users\\Donald\\Desktop\\box-pleating-studio/dist/index.htm","trace":true,"sourceMaps":true,"__workspaceFolder":"c:\\Users\\Donald\\Desktop\\box-pleating-studio","__sessionId":"75399f4e-4c31-4446-ba4e-7380607fe425"},"type":"request","seq":2}},"level":0}
{"tag":"dap.send","timestamp":1596546003891,"metadata":{"connectionId":1,"message":{"seq":3,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/launch","data":{"type":"pwa-chrome","request":"launch","os":"win32 x64","nodeVersion":"v12.8.1","adapterVersion":"1.47.5","parameters":"{\"type\":\"pwa-chrome\",\"name\":\"<string>\",\"request\":\"launch\",\"trace\":true,\"outputCapture\":\"console\",\"timeout\":10000,\"showAsyncStacks\":true,\"skipFiles\":[],\"smartStep\":true,\"sourceMaps\":true,\"pauseForSourceMap\":true,\"resolveSourceMapLocations\":null,\"rootPath\":\"<string>\",\"outFiles\":[\"<string>\",\"<string>\"],\"sourceMapPathOverrides\":{\"webpack://?:*/*\":\"<string>\",\"webpack:///./~/*\":\"<string>\",\"meteor://💻app/*\":\"<string>\"},\"__workspaceFolder\":\"<string>\",\"__autoExpandGetters\":false,\"address\":\"localhost\",\"port\":0,\"disableNetworkCache\":true,\"pathMapping\":{},\"url\":null,\"restart\":false,\"urlFilter\":\"\",\"webRoot\":\"<string>\",\"server\":null,\"targetSelection\":\"automatic\",\"vueComponentPaths\":[\"<string>\",\"<string>\"],\"cwd\":null,\"file\":\"<string>\",\"env\":{},\"includeDefaultArgs\":true,\"runtimeArgs\":null,\"runtimeExecutable\":\"stable\",\"userDataDir\":true,\"browserLaunchLocation\":\"workspace\",\"profileStartup\":false,\"cleanUp\":\"wholeBrowser\",\"preLaunchTask\":\"<string>\",\"__sessionId\":\"<string>\"}"}}}},"level":0}
{"tag":"dap.send","timestamp":1596546003893,"metadata":{"connectionId":1,"message":{"seq":4,"type":"event","event":"output","body":{"category":"console","output":"Verbose logs are written to:\nC:\\Users\\Donald\\AppData\\Local\\Temp\\vscode-debugadapter-0.json.gz\n"}}},"level":0}
{"tag":"dap.receive","timestamp":1596546003899,"metadata":{"connectionId":1,"message":{"command":"setExceptionBreakpoints","arguments":{"filters":[]},"type":"request","seq":3}},"level":0}
{"tag":"dap.send","timestamp":1596546003899,"metadata":{"connectionId":1,"message":{"seq":5,"type":"response","request_seq":3,"command":"setExceptionBreakpoints","success":true,"body":{}}},"level":0}
{"tag":"cdp.send","timestamp":1596546003920,"metadata":{"connectionId":1,"message":{"id":1,"method":"Target.attachToBrowserTarget","params":{}}},"level":0}
{"tag":"dap.receive","timestamp":1596546003926,"metadata":{"connectionId":1,"message":{"command":"configurationDone","type":"request","seq":4}},"level":0}
{"tag":"dap.send","timestamp":1596546003926,"metadata":{"connectionId":1,"message":{"seq":6,"type":"response","request_seq":4,"command":"configurationDone","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1596546003929,"metadata":{"connectionId":1,"message":{"command":"threads","type":"request","seq":5}},"level":0}
{"tag":"dap.send","timestamp":1596546003929,"metadata":{"connectionId":1,"message":{"seq":7,"type":"response","request_seq":5,"command":"threads","success":true,"body":{"threads":[]}}},"level":0}
{"tag":"cdp.receive","timestamp":1596546004480,"metadata":{"connectionId":1,"message":{"method":"Target.attachedToTarget","params":{"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97","targetInfo":{"targetId":"af384db8-da80-4c22-b548-8b58dfbe46ff","type":"browser","title":"","url":"","attached":true},"waitingForDebugger":false}}},"level":0}
{"tag":"cdp.receive","timestamp":1596546004480,"metadata":{"connectionId":1,"message":{"id":1,"result":{"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}}},"level":0}
{"tag":"cdp.send","timestamp":1596546004481,"metadata":{"connectionId":1,"message":{"id":2,"method":"Target.setDiscoverTargets","params":{"discover":true},"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}},"level":0}
{"tag":"cdp.receive","timestamp":1596546004520,"metadata":{"connectionId":1,"message":{"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"09FF8A3B733DE35123F266C97363D220","type":"page","title":"新分頁","url":"chrome://newtab/","attached":false,"browserContextId":"7C2C77DA4C9C57205169C5637290A84C"}},"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}},"level":0}
{"tag":"cdp.receive","timestamp":1596546004520,"metadata":{"connectionId":1,"message":{"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"4d6b5ceb-dbcc-4af3-929d-f6bb56c52599","type":"browser","title":"","url":"","attached":true}},"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}},"level":0}
{"tag":"cdp.receive","timestamp":1596546004520,"metadata":{"connectionId":1,"message":{"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"af384db8-da80-4c22-b548-8b58dfbe46ff","type":"browser","title":"","url":"","attached":true}},"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}},"level":0}
{"tag":"cdp.receive","timestamp":1596546004520,"metadata":{"connectionId":1,"message":{"id":2,"result":{},"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}},"level":0}
{"tag":"cdp.receive","timestamp":1596546004618,"metadata":{"connectionId":1,"message":{"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"09FF8A3B733DE35123F266C97363D220","type":"page","title":"新分頁","url":"chrome://newtab/","attached":false,"browserContextId":"7C2C77DA4C9C57205169C5637290A84C"}},"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}},"level":0}
{"tag":"dap.send","timestamp":1596546008888,"metadata":{"connectionId":1,"message":{"seq":8,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"initialize":{"operation":"initialize","totalTime":0.3,"max":0.3,"avg":0.3,"stddev":null,"count":1,"failed":0},"!initialize.errors":[],"setExceptionBreakpoints":{"operation":"setExceptionBreakpoints","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!setExceptionBreakpoints.errors":[],"configurationDone":{"operation":"configurationDone","totalTime":0.3,"max":0.3,"avg":0.3,"stddev":null,"count":1,"failed":0},"!configurationDone.errors":[],"threads":{"operation":"threads","totalTime":0.3,"max":0.3,"avg":0.3,"stddev":null,"count":1,"failed":0},"!threads.errors":[]}}}},"level":0}
{"tag":"dap.send","timestamp":1596546009484,"metadata":{"connectionId":1,"message":{"seq":9,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/cdp/operation","data":{"errors":[],"Target.attachedToTarget":{"operation":"Target.attachedToTarget","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!Target.attachedToTarget.errors":[],"Target.targetCreated":{"operation":"Target.targetCreated","totalTime":0.5,"max":0.3,"avg":0.2,"stddev":0.1,"count":3,"failed":0},"!Target.targetCreated.errors":[],"Target.targetInfoChanged":{"operation":"Target.targetInfoChanged","totalTime":0.2,"max":0.2,"avg":0.2,"stddev":null,"count":1,"failed":0},"!Target.targetInfoChanged.errors":[]}}}},"level":0}
{"tag":"runtime.launch","timestamp":1596546013895,"message":"Launch returned error","metadata":{"error":{"message":"Could not attach to main target","stack":"Error: Could not attach to main target\n\tat c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:1:33351\n\tat runNextTicks (internal/process/task_queues.js:58:5)\n\tat processTimers (internal/timers.js:472:9)\n\tat async _.prepareLaunch (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2620406)\n\tat async _.launch (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2621006)\n\tat async t.Binder.captureLaunch (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:73:25725)\n\tat async t.Binder._launch (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:73:25296)\n\tat async Promise.all (index 6)\n\tat async t.Binder._boot (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:73:24556)\n\tat async t.default._onMessage (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2459787)"},"wasCancelled":true,"name":"_"},"level":2}
{"tag":"dap.send","timestamp":1596546013897,"metadata":{"connectionId":1,"message":{"seq":10,"type":"response","request_seq":2,"command":"launch","success":false,"body":{"error":{"id":9221,"format":"Error processing launch: Error: Could not attach to main target\n\tat c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:1:33351\n\tat runNextTicks (internal/process/task_queues.js:58:5)\n\tat processTimers (internal/timers.js:472:9)\n\tat async _.prepareLaunch (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2620406)\n\tat async _.launch (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2621006)\n\tat async t.Binder.captureLaunch (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:73:25725)\n\tat async t.Binder._launch (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:73:25296)\n\tat async Promise.all (index 6)\n\tat async t.Binder._boot (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:73:24556)\n\tat async t.default._onMessage (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2459787)","showUser":false,"sendTelemetry":false}}}},"level":0}
{"tag":"dap.receive","timestamp":1596546013911,"metadata":{"connectionId":1,"message":{"command":"disconnect","arguments":{"restart":false},"type":"request","seq":6}},"level":0}
{"tag":"cdp.send","timestamp":1596546013912,"metadata":{"connectionId":1,"message":{"id":3,"method":"Browser.close","params":{},"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}},"level":0}
{"tag":"cdp.receive","timestamp":1596546013914,"metadata":{"connectionId":1,"message":{"id":3,"result":{},"sessionId":"4CC64DF51A85C917E12D9E844D2D3D97"}},"level":0}
{"tag":"runtime.exception","timestamp":1596546014444,"message":"Error running taskkill.exe","metadata":{"message":"Command failed: C:\\WINDOWS\\System32\\taskkill.exe /F /T /PID 17340\n���~: �䤣��B�z�{�� \"17340\"�C\r\n","stack":"Error: Command failed: C:\\WINDOWS\\System32\\taskkill.exe /F /T /PID 17340\n���~: �䤣��B�z�{�� \"17340\"�C\r\n\n\tat checkExecSyncError (child_process.js:634:11)\n\tat Object.execSync (child_process.js:670:15)\n\tat Object.execSync (electron/js2c/asar.js:696:23)\n\tat Object.t.killTree (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:21:169852)\n\tat t.ChildProcessBrowserProcess.kill (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:68:15332)\n\tat _.closeBrowser (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2610630)\n\tat processTicksAndRejections (internal/process/task_queues.js:85:5)\n\tat async _.disconnect (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2621226)\n\tat async Promise.all (index 6)\n\tat async t.Binder._disconnect (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:73:23873)\n\tat async c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:73:23170\n\tat async t.default._onMessage (c:\\Users\\Donald\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\ms-vscode.js-debug\\src\\extension.js:15:2459787)"},"level":3}
{"tag":"dap.send","timestamp":1596546014447,"metadata":{"connectionId":1,"message":{"seq":11,"type":"response","request_seq":6,"command":"disconnect","success":true,"body":{}}},"level":0}
{"tag":"dap.send","timestamp":1596546019451,"metadata":{"connectionId":1,"message":{"seq":12,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/dap/operation","data":{"errors":[],"disconnect":{"operation":"disconnect","totalTime":536,"max":536,"avg":536,"stddev":null,"count":1,"failed":0},"!disconnect.errors":[]}}}},"level":0}
xmedeko commented 4 years ago

Same problem with with "type": "pwa-chrome". The Chrome URL location bar shows nothing - i.e. it seems it gets no URL.

connor4312 commented 4 years ago

Duplicates https://github.com/microsoft/vscode/issues/102529