0

I was learning react and when I run 'npm start' command I got an error like this

node:events:371
  throw er; // Unhandled 'error' event
  ^                                                                             
Error: spawn firedragon 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 firedragon',
   path: 'firedragon',
   spawnargs: [ 'http://localhost:3000' ]
}

I actually removed firedragon which was a default browser of my os (garuda linux) I actually like to use opera browser and this error only started coming after I deleted firedragon browser

Please help me reach out of this problem

Luïs
  • 2,671
  • 1
  • 20
  • 33

3 Answers3

0

What are you running? Is this a fresh create-react-app project or something you cloned? :)

CodeKarl
  • 128
  • 6
  • Found a solution here: https://stackoverflow.com/questions/51706882/create-react-app-how-do-i-npm-start-with-a-specific-browser – CodeKarl Jun 24 '21 at 10:35
0

When you do npm start, after the build, React tries to open the default browser to your application's url.

Check and change your default browser or, if you're using create-react-app, you can change the browser with environment variables by running

BROWSER=opera npm start

If you want, you can completly disable this behaviour at project level by adding .env file with

BROWSER=none

with this you have to manually open the browser after the build

Vadim
  • 158
  • 1
  • 11
0

Assuming you have started with Create React App, you can use the BROWSER environment variable to specify a browser. By default, Create React App will use the default system browser.

In your case, you can try:

BROWSER=opera npm start

Refer https://create-react-app.dev/docs/advanced-configuration/ for more details.

Alternately, you can also try opening your preferred browser and setting it as the default system browser.

Vivek
  • 2,665
  • 1
  • 18
  • 20