エラー内容

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:485: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:291:12)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [ 'http://localhost:5173/' ]
}

原因, 改善

ブラウザを自動で起動するvite --openコマンドが原因.

package.jsonを以下のように書き換える

例: before


  "scripts": {
    "start": "vite --open --host 0.0.0.0",
    "build": "vite build"
  },

例: after

  "scripts": {
    "start": "vite --host 0.0.0.0",
    "build": "vite build"
  },