Skip to content

BROWSER no longer loads specified browser #12275

@aindriu80

Description

@aindriu80

Describe the bug

NPM is no longer loading the Browser (FireFox Developer Edition) I want to use for development purposes. A long time ago I used to be able to load a specified browser by specifying the browser name in the package.json file like this below......


"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "dev": "BROWSER=/opt/firefox/firefox HTTPS=true SSL_CRT_FILE=/etc/mkcert/localhost.pem SSL_KEY_FILE=/etc/mkcert/localhost-key.pem react-scripts start"
  },


FireFox Developer Edition is called Firefox in Ubuntu and is located in /opt/firefox. when I run npm run dev the regular Firefox browser loads instead. It's quite annoying because if i type in /opt/firefox/firefox in the command line FireFox Developer Edition loads up.

Did you try recovering your dependencies?

This is not the problem

Which terms did you search for in User Guide?

BROWSER

Environment

Environment Info:

current version of create-react-app: 5.0.0
running from /home/aindriu/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app

System:
OS: Linux 5.17 Pop!_OS 21.10
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Binaries:
Node: 17.3.1 - /usr/local/bin/node
Yarn: Not Found
npm: 8.3.0 - /usr/local/bin/npm
Browsers:
Chrome: 100.0.4896.75
Firefox: 99.0
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: Not Found

Steps to reproduce

  1. In Package.JSON I have the following "dev": "BROWSER=/opt/firefox/firefox
  2. Type in npm run dev
  3. Firefox standard edition loads up

Expected behavior

FireFox Developer Edition should load, just like it does from the command line.

Actual behavior

FireFox standard edition loads up

Reproducible demo

Using Ubuntu 21.10 - Having both FireFox and FireFox Developer Edition installed

Create a new React app with npx create-react-app test-app. Say yes to all the defaults when creating the app.

Install Firefox Developer Edition with this script - change the default language if you want

 
echo "Getting latest Firefox Developer Edition........................"
sudo wget -O firefox-dev-latest.tar.bz2 "https://download.mozilla.org/?product=firefox-devedition-latest-ssl&os=linux64&lang=ga-IE"
echo "Going to extract FireFox Developer into its own directory......."
sudo tar -xvjf firefox-dev-latest.tar.bz2
echo "Removing the existing edition of FireFox Developer Edition......"
sudo rm -r /opt/firefox
echo "Moving FireFox Developer Edition to /opt/firefox................"
sudo mv firefox /opt/
echo "Moving the downloaded Firefox Developer Edition to Trash........"
sudo rm firefox-dev-latest.tar.bz2
echo "Disabling firefox Notification.................................."
sudo cp -r distribution /opt/firefox/
echo "All done........................................................"

Go into the Package.json file and have the following


  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "dev": "BROWSER=/opt/firefox/firefox react-scripts start"
  },

In a terminal in the root of the project folder type... npm run dev

Notice how the regular edition of Firefox loads up with your React App.....

Very annoying !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions