{"id":680,"hash":"4dae4577a24530f4e3f8cc6c5524d1e8b8173dcce8fb5e6334f2d47ab76dd3fc","pattern":"&quot;vitest --ui&quot; causing &quot;Error: spawn xdg-open ENOENT&quot;","full_message":"I'm trying to check out Vitest's fancy UI server in my node docker container. But can't get it up and running. When running the npm script vitest --ui I get a node error spawn xdg-open ENOENT.\n\nHere the full error message:\n\n$ npm run test-ui\n\n> wpvite@0.0.0 test-ui\n> vitest --ui\n\n DEV  v0.23.4 /home/node/apps/main/frontend\n      UI started at http://localhost:51204/__vitest__/\n\nnode:events:491\n      throw er; // Unhandled 'error' event\n      ^\n\nError: spawn xdg-open ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:283:19)\n    at onErrorNT (node:internal/child_process:476:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\nEmitted 'error' event on ChildProcess instance at:\n    at ChildProcess._handle.onexit (node:internal/child_process:289:12)\n    at onErrorNT (node:internal/child_process:476:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {\n  errno: -2,\n  code: 'ENOENT',\n  syscall: 'spawn xdg-open',\n  path: 'xdg-open',\n  spawnargs: [ 'https://localhost:51204/__vitest__/' ]\n}\n\nNode.js v18.10.0\n\nGoogle is no help at all - nothing related to Vitest even close. Also I'm obviously not a Node.js expert.","ecosystem":"npm","package_name":"node.js","package_version":null,"solution":"Even though the Node.js error message appears pretty cryptic to me, I still was lucky to use Ubuntu as my primary OS (beside macOS) which made me draw my attention to xdg-open in the error message - I occasionally use the command to open all kind of programs/apps on Ubuntu. Don't know why, but you need to have xdg-open installed on your system, to be able to run vitest --ui, even though it's neither mentioned in Vitest nor in Vite Github repos with a single word. Anyway for debian based containers it's:\n\napt install xdg-utils --fix-missing\n\nAllthough this made the ENOENT error go away and the UI server starts up without errors, I still don't get to see the UI app due to some runtime-dom errors... I give it up. But maybe someone else finds the xdg-open info helpful.\n\nUPDATE: It's working!\nI just had to append /__vitest__/ to my proxied local url as clearly described in the docs:\n\n\"Then you can visit the Vitest UI at http://localhost:51204/__vitest__/\"","confidence":0.85,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/73942710/vitest-ui-causing-error-spawn-xdg-open-enoent","votes":7,"created_at":"2026-04-19T04:51:28.857894+00:00","updated_at":"2026-04-19T04:51:28.857894+00:00"}