-
-
Notifications
You must be signed in to change notification settings - Fork 531
Description
What happened?
Bug Report: AI-Toolkit installation fails on Linux due to missing PATH entries
Environment:
- OS: Linux (CachyOS / Arch-based)
- Stability Matrix version: latest
- Package: AI-Toolkit
Issue:
Installing AI-Toolkit fails with two separate errors caused by Stability Matrix running child processes with a restricted PATH environment that does not
include /usr/bin.
Error 1 — npm install fails:
npm error code ENOENT
npm error syscall spawn sh
npm error path .../AI-Toolkit/ui/node_modules/prisma
npm error errno -2
npm error enoent spawn sh ENOENT
Prisma's postinstall script spawns sh via Node.js child_process. Because Stability Matrix's RunNpm does not include /usr/bin in PATH, sh cannot be found
even though it exists at /usr/bin/sh.
Error 2 — GPU detection fails in the Web UI:
No NVIDIA GPUs detected! nvidia-smi is not available on this system.
nvidia-smi not found or not accessible
ui/src/app/api/gpu/route.ts runs which nvidia-smi via exec(). The Node.js process inherits SM's restricted PATH, so nvidia-smi is not found even though it
exists at /usr/bin/nvidia-smi.
Root cause:
UnixPrerequisiteHelper.RunNpm and the Next.js server process are started without /usr/bin in PATH. On Linux, /usr/bin is not guaranteed to be inherited —
it must be explicitly set.
Suggested fix:
When launching any subprocess on Linux, ensure PATH includes at minimum /usr/bin:/usr/local/bin:/bin. For example:
env["PATH"] = "/usr/bin:/usr/local/bin:/bin:" + (env.GetValueOrDefault("PATH") ?? "");
Workarounds applied by user:
- Created symlink: ln -s /usr/bin/sh /mnt/.../Assets/nodejs/bin/sh
- Patched compiled Next.js route to use absolute path /usr/bin/nvidia-smi -L
Steps to reproduce
No response
Relevant logs
Version
v2.16.0-dev.2+c162a79
What Operating System are you using?
Windows