-
-
Notifications
You must be signed in to change notification settings - Fork 27k
BROWSER Environment Variable Not Picked Up #9531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @danieldogeanu, you are correct that the Does The documentation says that the |
I tried setting the BROWSER variable in .env and defining it before npm start and always opens my default browser. react-scripts: 3.4.3 |
Hi @petetnt, No, it doesn't work that way either. Storing variables in |
I also discovered that |
Ah my bad, you could try using the cross-env package for example, try changing the
and running If you are using the basic cmd prompt,
That's interesting, possible Windows regression? |
I've just updated from v3.4.1 to v3.4.1 and my simple script from package.json has also stopped working correctly: |
Hi! Having the same problem after trying both approaches, I'm on macOS Catalina (10.15.6). BTW, the |
Ok, so apparently it was indeed an issue with |
Hello! I'm having exactly the same issue. The |
@JaumeFigueras I had the same problem, but with the inverse browsers 😆 This solved my issue: (For your case invert the browsers)
I run Kubuntu, and KDE config was saying my default browser was Firefox, so may be a Ubuntu bug? idk Now it opens with my real default browser, |
@TheJltres thanks for the hint, xdg-settings fixed it for me as well. My platform: So doesn't seem to be isolated to Ubuntu. Weird behavior all over the place. |
Hey guys, I have a bit of a problem with environment variables being picked up from .env files.
Bug Description
When I add a
.env.local
file in the root of my project, with a fresh install of the Create React App, the BROWSER variable is not picked up by the React App and the specified browser is not opened. I usually use Firefox Developer Edition for development, and this is a bit frustrating. Here's the contents of my.env.local
file:Environment
Info:
Package.json:
Steps to Reproduce
Install a fresh copy of Create React App via
npx create-react-app your-app-name
;Add a
.env.local
file to the root of the project and add the following contents:Note: You can test on a different browser path.
npm start
in the command line.Expected Behavior
Should launch the app in Firefox Developer Edition browser.
Actual Behavior
The app opens in the default browser.
I have the suspicion that the environment variables are not loaded properly. If I add
REACT_APP_
before the variable name, it shows in theprocess.env
, but the name of the variable should beBROWSER
and notREACT_APP_BROWSER
, as per documentation.Can you guys help me? Thanks!
The text was updated successfully, but these errors were encountered: