Prisma Studio on Linux: spawn xdg-open ENOENT — Root Cause, Fix, and Environment Hardening
Running:
pnpm prisma studio
may return:
Error: spawn xdg-open ENOENT
while Prisma Studio still starts on localhost. This means the service is healthy; only the OS browser helper is missing.
Why this happens
Node tries to spawn xdg-open to open the browser automatically. In headless SSH sessions, minimal Docker images, or WSL contexts without proper GUI bridging, that binary is unavailable.
Fast diagnostics
which xdg-open
curl -I http://localhost:51212
If Prisma port responds, this is not a database/runtime failure.
Engineering fixes
- Manual browser open (quick support fix).
- Install
xdg-utilson desktop Linux. - Preferred for server/CI: disable auto-open.
pnpm prisma studio --browser none
# or
BROWSER=none pnpm prisma studio
WSL nuance
In WSL, use wslview (from wslu) to open links in Windows browser, or keep --browser none and open manually.
DevOps hardening
- add shell alias for stable local behavior;
- detect missing
xdg-openduring bootstrap; - avoid running Prisma Studio in CI/CD production paths;
- treat this error as environment signal, not app failure.
Conclusion
spawn xdg-open ENOENT is an environment integration issue between Prisma/Node and OS graphical helpers. Apply environment-specific policy and keep runtime behavior explicit for predictable operations.
This post is licensed under CC BY-NC.
Comments
Join the discussion below.
Comments are not configured yet. Add Cusdis settings in /assets/json/config/blog-comments-config.json.