Running npm start without opening browser
- Posted in
- visual studio code
So you are working on a React app and, to test it, you repeatedly run
npm start in the Powershell terminal window of Visual Studio Code. Only you have a browser open on the application and don't want to open another one whenever you restart the server. Or perhaps you have a default browser that is not optimal.
The solution is to set the environment variable BROWSER to either "none" or "chrome" or whatever browser you need. In order to set it in the same Powershell terminal, use
$Env:BROWSER="none". Now running
npm start will not open a new browser window/tab.
More details here: Advanced Configuration