问题
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.
来源:https://stackoverflow.com/questions/65774451/vs-code-with-wsl-now-opens-the-browser-sh-file-instead-of-launching-the-browser