When you start Creact-React-App, it's default configuration is to open your application in the default browser for your operating system.

This can be an annoying feature to have a browser window pop open every time you start or restart your application. So, what if you want to disable this feature? And have Create-React-App not open any browser at all?

Luckily, Create-React-App has a built-in way to control this by setting the BROWSER environment variable. You can add the environment variable directly into the scripts section of your package.json file.

Here is what the environment variable looks like:

    
      BROWSER=none
    
  

Notice that we also give the BROWSER environment variable a value of none. This is what tells Create-React-App to not open any browser.

If you wanted to add this to the npm start script in your package.json file, this is what it looks like:

    
      . . .
      
      "scripts": {
        "start": "BROWSER=none react-scripts start"
      },
      
      . . .
    
  

When you run your application with the npm start command, you'll notice that no browser windows are opened.

Check out the Create-React-App documentation for more configuration and environment variable options.

If you are wondering how to open the application in a specific browser, we wrote a guide on that as well.

Thanks for reading and happy coding!