6

The problem: when running a React project (i.e. npm run start) with WSL from the terminal in VS Code, the file "browser.sh" is opened in a new window. The browser is no longer launched.

This is a new behavior with version 1.52. The release notes indicate that they now add the system variable "BROWSER" and use it to launch the browser. In my case it is set to /home/dan/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/bin/helpers/browser.sh

The browser.sh file is a shell script created by VS Code. It exists and has executable permissions (-rwxr-xr-x).

The workaround: Type unset BROWSER every time a terminal is opened inside VS Code.

The desired solution: Convince VS Code to run the shell script or to launch the default browser directly.

Dan J.
  • 71
  • 3
  • I started having a different browser launch problem in the same timeline, so I believe related. In my case, a bash window running browser.sh opens but displays error message `bash: \wsl$\Ubuntu\home\myname\.vscode-server\bin\ea3859d4ba2f3e577a159bc91e3074c5d85c0523/node: cannot execute binary file: Exec format error /usr/bin/bash: Exit 126.` – Daryn Feb 02 '21 at 06:26
  • 1
    Incidentally, this problem does not occur when running `yarn start` from Windows Terminal, only from the VS Code terminal. (which I guess shouldn't be surprising considering @Dan J.'s finding that `unset BROWSER` in the VS Code terminal also makes the issue go away) – Daryn Feb 02 '21 at 06:31
  • 1
    Updating `react-scripts` to 4.0.2 seems to fix this on my computer. – Wes Lord Feb 09 '21 at 02:02

0 Answers0