facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.52k stars 26.77k forks source link

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

Open stacy-rendall opened 2 years ago

stacy-rendall commented 2 years ago

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

hongz1 commented 2 years ago

same thing happened to me.

DarinDev1000 commented 2 years ago

Same Issue on "react-scripts": "4.0.3"

julioflima commented 1 year ago

Still!!!

Kos-M commented 1 year ago

Same..

ArnieGA commented 1 year ago

Same here... 2023! Wow!

kovryzhenko commented 1 year ago

I'm using env-cmd -e local and have the same problem...

sKopheK commented 1 year ago

on windows, the only value that works is BROWSER=none. all others open default system browser due to invalid usage of open library after breaking changes in v8

this PR https://github.com/facebook/create-react-app/pull/11878 would fix it, not sure why it's still not merged.