1

I have a React SPA that that uses Parcel as the build tool/dev server. I'm trying to get it running inside a Docker container, but when I run the parcel serve command, I get an error like this:

$ parcel src/index.html --open --port 3000
node:events:492
      throw er; // Unhandled 'error' event
      ^
Error: spawn xdg-open ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [ 'http://localhost:3000' ]
}

What would cause this?

1 Answer 1

3

Figured it out!

As you can see in the output, I ran the parcel serve command with the --open flag (that's how it was set up in the package.json script). The problem is, that flag tells Parcel to try to open the app in a browser window which doesn't make sense in the context of a Docker container.

Removing the --open flag fixed the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.