LykosAI/StabilityMatrix · error · ProcessException
RunNpm with args [ ] failed with exit code
Error message
RunNpm with args [{args}] failed with exit code {process.ExitCode}:
{stdOut}
{stdErr} What it means
RunNpm launches npm (for A3/ComfyUI-Manager style package scripts) and throws ProcessException with args, exit code, stdout, and stderr whenever the process exits nonzero. It surfaces npm command failures to the package install/update flow.
Solutions
- Inspect the stdOut/stdErr in the exception to identify the npm failure and address it.
- Ensure Node.js/npm are installed and on PATH (install via distro package or nvm).
- Fix network/registry access (proxy config, npmrc registry mirror) and retry.
- Clear the package's node_modules and lockfile and rerun the npm step.
Defensive patterns
Strategy: try-catch
Validate before calling
var npmPath = which("npm"); // e.g. ProcessRunner 'command -v npm'
if (string.IsNullOrEmpty(npmPath)) throw new Exception("npm is required but not installed"); Try / catch
try { await helper.RunNpm(args); }
catch (ProcessException ex)
{ logger.Error(ex, "npm step failed; see stdout/stderr in message"); } Prevention
- Install Node.js/npm (via distro packages or nvm) before package installs that need it.
- Configure npm registry/proxy access in .npmrc.
- Clear node_modules and lockfiles after dependency resolution failures.
- Keep Node at a version the package supports.
When it happens
Trigger: Any npm run via RunNpm exiting nonzero — npm not installed/wrong PATH, registry unreachable, dependency resolution (npm install) failure, or the invoked script itself erroring.
Common situations: Node/npm missing on Linux so PATH lookup fails; offline or rate-limited npm registry; peer-dependency conflicts during install; package's npm script failing due to code errors.
Related errors
- Git command [ ] failed with exit code
- dotnet8 with args [ ] failed with exit code
- Git installation canceled
- install.py for exited with code
- pip install failed with code
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/7a7e4d8ff0277df3.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs:456
);
await process.WaitForExitAsync();
if (process.ExitCode == 0)
return;
var stdOut = await process.StandardOutput.ReadToEndAsync();
var stdErr = await process.StandardError.ReadToEndAsync();
Logger.Error(
"RunNpm with args [{Args}] failed with exit code " + "{ExitCode}:\n{StdOut}\n{StdErr}",
args,
process.ExitCode,
stdOut,
stdErr
);
throw new ProcessException(
$"RunNpm with args [{args}] failed with exit code" + $" {process.ExitCode}:\n{stdOut}\n{stdErr}"
);
}
public AnsiProcess RunNpmDetached(
ProcessArgs args,
string? workingDirectory = null,
Action<ProcessOutput>? onProcessOutput = null,
IReadOnlyDictionary<string, string>? envVars = null
)
{
return ProcessRunner.StartAnsiProcess(
NpmPath,
args,
workingDirectory,
onProcessOutput,
envVars ?? new Dictionary<string, string>()
);View on GitHub (pinned to af93d6ef57)