A strange bug was found in WSL today. Shouldn't sh be called directly under WSL

use Create React App Create a react application, yarn start Now, output Starting the development server... And then throw one Error: spawn cmd.exe ENOENT I wonder how this WSL is called to windows again cmd.exe It's weird. Hey

go create-react-app Turn it over Source code , executed an operation to open the browser and found that open Class library judgment windows Not just checking process.platform Yes, by the way wsl and docker The environment is also used as the judgment condition. The following splicing command is the final source of all evil

 root of all evils

Two ways to fix this bug

  1. take /mnt/c/Windows/System32 Add back the WSL environment variables so that you can pull up the default browser
  2. react-scripts/scripts/start.js Note it out openBrowser(url.localUrlForBrowser);

label: wsl

Add a new comment