报错:The CJS build of Vite’s Node API is deprecated. See
https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

VITE v5.1.4 ready in 2298 ms

➜ Local: http://localhost:80/ ➜ Network: http://10.0.4.13:80/
➜ press h + enter to show help node:events:491
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:80/’ ] }

如果你的系统没有 apt-get 命令,可能是因为你使用的不是Debian系的Linux发行版(如Ubuntu),而是其他类型的Linux发行版,或者是Windows或macOS系统。以下是针对不同系统的解决方案:

对于不同的Linux版本,安装 xdg-utils 包
  • Red Hat系Linux(如Fedora、CentOS)
sudo yum install xdg-utils

在较新的系统上

sudo dnf install xdg-utils
  • Arch系Linux
sudo pacman -S xdg-utils