Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't debug web (eg ReactJS project) by Microsoft Edge or Chrome #1628

Closed
viethung9at1 opened this issue Mar 31, 2023 · 36 comments · Fixed by #1629
Closed

Can't debug web (eg ReactJS project) by Microsoft Edge or Chrome #1628

viethung9at1 opened this issue Mar 31, 2023 · 36 comments · Fixed by #1629
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release verified Verification succeeded

Comments

@viethung9at1
Copy link

viethung9at1 commented Mar 31, 2023

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.77.0
  • OS Version: WSL2 (on both Ubuntu 18.04 and Ubuntu 20.04)- Windows 11 build 22624.1470
    Steps to Reproduce:
  1. Create a new ReactJS app (no code modified)
  2. Press F5 and choose Web(Edge) debug
  3. Error: Unable to lanuch brower: (void 0) is not a constructor
@vscodenpa
Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.77.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@nicolasalt
Copy link

nicolasalt commented Mar 31, 2023

I have the same issue, VS Code Version: 1.77.0 on WSL2 under Windows 10, fully updated.
Started today, with the recent VS Code update.

Relevant: https://stackoverflow.com/questions/75894025/vs-code-debug-with-chrome-spitting-out-weird-error-after-no-change-unable-to-la

@inadsan
Copy link

inadsan commented Mar 31, 2023

Same issue, VS Code Version: 1.77.0 + Dev Container (all rebuild)
Started today

@Muttley
Copy link

Muttley commented Mar 31, 2023

Same issue here, with non-React project. Windows 10, WSL2.

Reverting to VS Code 1.76.2 resolves the issue

@roblourens roblourens assigned connor4312 and unassigned roblourens Mar 31, 2023
@connor4312 connor4312 transferred this issue from microsoft/vscode Mar 31, 2023
@connor4312 connor4312 added the bug Issue identified by VS Code Team member as probable bug label Mar 31, 2023
connor4312 added a commit that referenced this issue Mar 31, 2023
Fixes #1628

Moving to esbuild caused it to pull in the "wrapper.mjs" which doesn't
expose the same API that `ws` normally does.

See websockets/ws#2032 (comment)
@connor4312 connor4312 added the candidate Issue identified as probable candidate for fixing in the next release label Mar 31, 2023
@connor4312 connor4312 added this to the March 2023 Recovery 1 milestone Mar 31, 2023
connor4312 added a commit that referenced this issue Mar 31, 2023
Fixes #1628

Moving to esbuild caused it to pull in the "wrapper.mjs" which doesn't
expose the same API that `ws` normally does.

See websockets/ws#2032 (comment)
connor4312 added a commit that referenced this issue Mar 31, 2023
Fixes #1628

Moving to esbuild caused it to pull in the "wrapper.mjs" which doesn't
expose the same API that `ws` normally does.

See websockets/ws#2032 (comment)
@connor4312
Copy link
Member

This will be fixed in the nightly build available shortly after 5PM PST today. I will also propose it for a recovery release next week.

@TKraus27
Copy link

I tried the nightly build, however I am getting 'unable to attach to browser'

@connor4312
Copy link
Member

connor4312 commented Apr 1, 2023

@TKraus27 the nightly build only just came out


This is now fixed in the nightly build. Note that you will need to install that in the remote workspace. I will also propose it for a recovery release next week.

@TKraus27
Copy link

TKraus27 commented Apr 1, 2023

I just tried it again. Still 'unable to attach to browser' error. Not sure what the issue is as it is a very general error

@adviner
Copy link

adviner commented Apr 1, 2023

Tried the nightly build and now getting the following error

Unable to launch browser: Unable to find an installation of the browser on your system. Try installing it, or providing an absolute path to the browser in the runtimeExecutable in your launch.json

@TKraus27
Copy link

TKraus27 commented Apr 1, 2023

I initially had the same error as @adviner has stated above. my error has since changed after doing various troubleshooting.

@adviner
Copy link

adviner commented Apr 1, 2023

TKraus27 what did you change to get over the issue I'm facing?

@TKraus27
Copy link

TKraus27 commented Apr 1, 2023

@adviner not sure entirely. one thing I did do was try installing chrome via the terminal using their debian package. it didn't really seem to give a full success on install. and alas I am still faced with 'unable to attach to browser'. other than that, I think all I did was reinstall the 'Javascript Debugger (nightly)" extension and relaunch vscode a few times.

@liangsqrt
Copy link

liangsqrt commented Apr 1, 2023

i also meet this problem, it seems like there is no launcher in my system, but i do really have installed it and all work fine yesterday

Tried the nightly build and now getting the following error

Unable to launch browser: Unable to find an installation of the browser on your system. Try installing it, or providing an absolute path to the browser in the runtimeExecutable in your launch.json

@Ashesh3
Copy link
Contributor

Ashesh3 commented Apr 1, 2023

@connor4312
Nightly build does not fix this issue:

[Window Title]
Visual Studio Code

[Content]
Unable to launch browser: "Unable to find an installation of the browser on your system. Try installing it, or providing an absolute path to the browser in the "runtimeExecutable" in your launch.json."

[Open 'launch.json'] [Cancel]

@adviner
Copy link

adviner commented Apr 1, 2023

I had to finally revert back to 2.7.6 and turned off automatic updates until this issue is fixed.

@louis-lau
Copy link

Same as above for me

@connor4312
Copy link
Member

Ah, sorry, one more change is needed for now: add "browserLaunchLocation": "ui" to your launch config. I will put a fix in and make a special nightly release today for that.

connor4312 added a commit that referenced this issue Apr 1, 2023
Previously, the package.json pulled in at the bundle step was the "nightly"-treated version, but this is no longer the case. This causes nightly to not be able to automatically determine it's running in a remote workspace, since the extensionId is wrong.

Instead, define the version, package name, and publisher as compile-time constants.

Refs #1628 (comment)
@TKraus27
Copy link

TKraus27 commented Apr 2, 2023

@connor4312 adding the "browserLaunchLocation": "ui" to my launch.json worked for me. I'm using the nightly build of the Javascript Debugger extension

@TKraus27
Copy link

TKraus27 commented Apr 2, 2023

I have a new issue which is arising. Launching my next.js project through a launch configuration is causing issues. I can't get it to fully launch unless I run the npm run dev command in terminal manually.

here is what shows up in terminal when I run the config:

/usr/bin/env 'NODE_OPTIONS=--require /home/tkraus/.vscode-server/extensions/ms-vscode.js-debug-nightly-2023.3.3117/src/bootloader.js --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"/tmp/node-cdp.80-87dac7be-48.sock","deferredMode":false,"waitForDebugger":"","execPath":"/usr/bin/node","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"/tmp/node-debug-callback-095161b19d0c47a3"}' /usr/bin/npm run-script dev

here is what my launch config looks like:

"name": "Next.js: Launch",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "npm",
      "runtimeArgs": [ "run-script", "dev"],
      "console": "integratedTerminal",
      "skipFiles": [
        "<node_internals>/**"
      ]

@connor4312
Copy link
Member

Please open a new issue for that. A screencap using gifcap.dev would be useful as well.

connor4312 added a commit that referenced this issue Apr 2, 2023
Previously, the package.json pulled in at the bundle step was the "nightly"-treated version, but this is no longer the case. This causes nightly to not be able to automatically determine it's running in a remote workspace, since the extensionId is wrong.

Instead, define the version, package name, and publisher as compile-time constants.

Refs #1628 (comment)
@jimrandell
Copy link

same issue: died right after update

  • Version: 1.77.0 (user setup)
  • Commit: 7f329fe6c66b0f86ae1574c2911b681ad5a45d63
  • Date: 2023-03-29T10:02:16.981Z
  • Electron: 19.1.11
  • Chromium: 102.0.5005.196
  • Node.js: 16.14.2
  • V8: 10.2.154.26-electron.0
  • OS: Windows_NT x64 10.0.19045
  • Sandboxed: No

@flyfishMT
Copy link

@TKraus27 the nightly build only just came out

This is now fixed in the nightly build. Note that you will need to install that in the remote workspace. I will also propose it for a recovery release next week.

Can you elaborate? I have no options on where to install, but it shows "Extension is Enabled on WSL:Ubuntu" but still getting 'unable to attach to browser'. I'm not running insiders build of VS Code just the standard. Thank you

@louis-lau
Copy link

Just downgrading VSCode one version and disabling updates was easier for me. I'll just re-enable the updates on the next release.

@Ashesh3
Copy link
Contributor

Ashesh3 commented Apr 3, 2023

@TKraus27 the nightly build only just came out
This is now fixed in the nightly build. Note that you will need to install that in the remote workspace. I will also propose it for a recovery release next week.

Can you elaborate? I have no options on where to install, but it shows "Extension is Enabled on WSL:Ubuntu" but still getting 'unable to attach to browser'. I'm not running insiders build of VS Code just the standard. Thank you

Search for @id:ms-vscode.js-debug-nightly in the extensions view

@flyfishMT
Copy link

@TKraus27 the nightly build only just came out
This is now fixed in the nightly build. Note that you will need to install that in the remote workspace. I will also propose it for a recovery release next week.

Can you elaborate? I have no options on where to install, but it shows "Extension is Enabled on WSL:Ubuntu" but still getting 'unable to attach to browser'. I'm not running insiders build of VS Code just the standard. Thank you

Search for @id:ms-vscode.js-debug-nightly in the extensions view

Yes, I do have that enabled, and the standard one disabled. I was questioning this part:

Note that you will need to install that in the remote workspace.

@Ashesh3
Copy link
Contributor

Ashesh3 commented Apr 3, 2023

@TKraus27 the nightly build only just came out
This is now fixed in the nightly build. Note that you will need to install that in the remote workspace. I will also propose it for a recovery release next week.

Can you elaborate? I have no options on where to install, but it shows "Extension is Enabled on WSL:Ubuntu" but still getting 'unable to attach to browser'. I'm not running insiders build of VS Code just the standard. Thank you

Search for @id:ms-vscode.js-debug-nightly in the extensions view

Yes, I do have that enabled, and the standard one disabled. I was questioning this part:

Note that you will need to install that in the remote workspace.

It automatically gets enabled on the remote, even I get the "Extension is enabled on remote name" message on the extension page. Using vscode standard. Can you share your launch.json file? Here's mine that works:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "msedge",
            "request": "launch",
            "name": "Launch Edge against localhost",
            "url": "http://localhost:4000",
            "webRoot": "${workspaceFolder}",
        }
    ]
}

@TKraus27
Copy link

TKraus27 commented Apr 3, 2023

@Ashesh3 you need to add "browserLaunchLocation": "ui" to your launch.json configuration as connor4312 had stated in an earlier post

@Ashesh3
Copy link
Contributor

Ashesh3 commented Apr 3, 2023

@Ashesh3 you need to add "browserLaunchLocation": "ui" to your launch.json configuration as connor4312 had stated in an earlier post

He said that adding "browserLaunchLocation": "ui" to the configuration was a temporary workaround until he fixed it in the next nighty build, I think we do not need it anyone, can you try without that?

@TKraus27
Copy link

TKraus27 commented Apr 3, 2023

@Ashesh3 I tried without it and it does seem to work for me. I thought that may have been a possible fix but it seems like it has already been updated in the nightly build.

@connor4312
Copy link
Member

Yes, there is already a build out that removes the need for manually specifying browserLaunchLocation

@flyfishMT
Copy link

@TKraus27 the nightly build only just came out
This is now fixed in the nightly build. Note that you will need to install that in the remote workspace. I will also propose it for a recovery release next week.

Can you elaborate? I have no options on where to install, but it shows "Extension is Enabled on WSL:Ubuntu" but still getting 'unable to attach to browser'. I'm not running insiders build of VS Code just the standard. Thank you

Search for @id:ms-vscode.js-debug-nightly in the extensions view

Yes, I do have that enabled, and the standard one disabled. I was questioning this part:

Note that you will need to install that in the remote workspace.

It automatically gets enabled on the remote, even I get the "Extension is enabled on remote name" message on the extension page. Using vscode standard. Can you share your launch.json file? Here's mine that works:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "msedge",
            "request": "launch",
            "name": "Launch Edge against localhost",
            "url": "http://localhost:4000",
            "webRoot": "${workspaceFolder}",
        }
    ]
}

Yours works for me thank you. The same exact config with "type": "pwa-chrome" does not.

@Ashesh3
Copy link
Contributor

Ashesh3 commented Apr 3, 2023

@TKraus27 the nightly build only just came out
This is now fixed in the nightly build. Note that you will need to install that in the remote workspace. I will also propose it for a recovery release next week.

Can you elaborate? I have no options on where to install, but it shows "Extension is Enabled on WSL:Ubuntu" but still getting 'unable to attach to browser'. I'm not running insiders build of VS Code just the standard. Thank you

Search for @id:ms-vscode.js-debug-nightly in the extensions view

Yes, I do have that enabled, and the standard one disabled. I was questioning this part:

Note that you will need to install that in the remote workspace.

It automatically gets enabled on the remote, even I get the "Extension is enabled on remote name" message on the extension page. Using vscode standard. Can you share your launch.json file? Here's mine that works:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "msedge",
            "request": "launch",
            "name": "Launch Edge against localhost",
            "url": "http://localhost:4000",
            "webRoot": "${workspaceFolder}",
        }
    ]
}

Yours works for me thank you. The same exact config with "type": "pwa-chrome" does not.

Try "type": "chrome" once.

@TKraus27
Copy link

TKraus27 commented Apr 3, 2023

I use "type": "chrome". the pwa-chrome option is an older method of attaching to chrome if I remember correctly

@flyfishMT
Copy link

flyfishMT commented Apr 3, 2023

Try "type": "chrome" once.

Still "Unable to attach browser" for "type": "chrome"

@codycodes
Copy link

Fixed for me without any configuration changes after update → v1.77.2

@mofojed
Copy link

mofojed commented May 11, 2023

I was still having problems in v1.77.3, turns out I had VSCode installed through snap. I tried installing with the .deb package and that seems to have fixed the issue: https://code.visualstudio.com/docs/setup/linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.