I am using Manjaro and have downloaded google-chrome-stable from the AUR package. Even though google chrome is set as a default browser, npm start still defaults to opening firefox, after I deleted firefox I start receiving the following error
Starting the development server...
node:events:342
throw er; // Unhandled 'error' event
^
Error: spawn /usr/bin/firefox ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:480:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:480:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /usr/bin/firefox',
path: '/usr/bin/firefox',
spawnargs: [ 'http://localhost:3000' ]
}
React uses the BROWSER
environment variable to decide what browser to use. Try running your React app as follows:
BROWSER=/usr/bin/google-chrome-stable npm start
If this works fine, you can set Chrome to be the default in these cases by adding
export BROWSER=/usr/bin/google-chrome-stable
to your terminal profile (~/.zshrc
, if you're using zsh).