How to change default browser? Npm error

Hi guys, I’am freshman to manjaro.
I installed manjaro KDE, then installed my programs for web development. After this i wanted to start my react app using npm start.
But i Got a error that usr/bin/Firefox
I think this problem is because i uninstalled Firefox and installed Google Chrome but how do y change that in terminal?

With KDE the default browser can be set :

  • KDE System configuration Applications
  • Directly in the browser

But in your case I suspect a miss configuration of npm
Firefox is located /usr/bin/firefox (all lowercase)

I know that but i want to my npm start use usr/bin/google-chrome but to do that i need to change $BROWSER variable but i dont know where it is and how to do it

If you use bash, then add this to your ~/.bashrc:

export BROWSER="$(if [[ -n $DISPLAY ]] && [[ -n $(which google-chrome) ]]; then echo 'google-chrome'; else echo 'firefox'; fi)"

Except for I dont think thats the thing.
That isnt a common variable - I dont have it set for example.
( do you? echo $BROWSER )
The wiki article is referencing it for very specific cases where it could useful:

BROWSER contains the path to the web browser. Helpful to set in an interactive shell configuration file so that it may be dynamically altered depending on the availability of a graphic environment, such as X

And thus … I dont think some bashrc magic to set it is really the right approach.

The issue is likely in their npm setup as already stated:

Some Google answers about

react npm how to set default browser

You may found a npm module as helper or some suggestion to use .env file or a Tuto.

I went searching for npm but I cannot find out what it is or does, only that it seems to be important for node.js.
Anyway, I am hoping to solve, and help to solve this by way of adding what I found.

  1. I am attempting to use Google Earth Pro on my KDE Manjaro system.
  2. When I attempt to launch an external browser (Like in the menus of “File/View in Google Maps”) I get an error.

In following this thread, and THIS ONE, I dont get anywhere other than to change system information which I do ot understand nor want to bugger up.

However, one advice was to check what the variable was set too:
$ xdg-mime query default x-scheme-handler/https

Yes! @cscs … I was not able to keep up with de-googling a browser for daily use. Hehehe. But I did appreciate your help!

Then I went to the terminal with:
$ echo $BROWSER

Firefox huh!?
That is funny because I had uninstalled firefox!

So, this might be why the error, and also, is it possible to track down WHERE this setting of $BROWSER is coming from? If so, it might answer my question as well as teach me how to find out where things are coming from!

Thanx in advance.

From HERE I did get into the env facility which does have the BROWSER=. But that is for Arch and I am not sure how similar it would be to Manjaro. I think I am going to try to change that and see if GEP opens in a browser.

Changed with env BROWSER=brave-browser.desktop but it did not change the reaction from within Google Earth pro. I have to wonder if that even launches the browser correctly and or if the system only reads from the env list once when started or more.

Another UPDATE:
Reading further I stuck BROWSER=brave (brave being the way I found to launch the browser from a terminal, though I am sure I am supposed to launch it with a .desktop file instead! Ha!
I did this with editing the key pair in the etc/environment file. Then giving: source ~/.bash_profile and source /etc/environment.
Now the echo for BROWSER is “brave”, but it still fails in GEP.

I think I had better quit for now or I might screw things up.

Any help appreciated!

Thank you a lot! Typed google-chrome-stable instead of google-chrome and solved my problem. “npm run start” now use Chrome as default browser.

export BROWSER="$(if [[ -n $DISPLAY ]] && [[ -n $(which google-chrome-stable) ]]; then echo ‘google-chrome-stable’; else echo ‘firefox’; fi)"

I know this is an old article but today I ran into a similar issue, i fixed it by adding export BROWSER=my browser and it works fine now. But my question is that you said you find the environment facility which contains “BROWSER=” , I want to know which file is that because I tried a lot and couldn’t find where it is coming from. I know that it is not a global environment variable because “sudo printenv” don’t show any BROWSER variable so i think it should be a user setting but where it is?