Skip to content

react-scripts@5 BROWSER in .env file is not working #11942

@stacy-rendall

Description

@stacy-rendall

Describe the bug

With react-scripts@5 BROWSER is not working when placed in an .env file (I'm using .env.local in this case)

i.e. BROWSER=msedge used to work with react-scripts@4, with v5 this is ignored and the default browser opens

Did you try recovering your dependencies?

Node version: 16.13.2
NPM version: 8.3.1

Which terms did you search for in User Guide?

Following guide here: https://create-react-app.dev/docs/advanced-configuration/

Environment

Environment Info:

current version of create-react-app: 5.0.0
running from C:\Users[username]\scoop\persist\nodejs-lts\cache_npx\c67e74de0542c87c\node_modules\create-react-app

System:
OS: Windows 10 10.0.19044
CPU: (12) x64 Intel(R) Xeon(R) E-2176M CPU @ 2.70GHz
Binaries:
Node: 16.13.2 - ~\scoop\apps\nodejs-lts\current\node.EXE
Yarn: Not Found
npm: 8.3.1 - ~\scoop\apps\nodejs-lts\current\bin\npm.CMD
Browsers:
Chrome: 97.0.4692.71
Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.62)
Internet Explorer: Not Found
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. set BROWSER in .env.local file
  2. npm start

Expected behavior

Specified browser opens

Actual behavior

System default browser opens, not as specified above

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