paperclipai/paperclip · error
npm install failed for ${spec}: ${String(err)}
Error message
npm install failed for ${spec}: ${String(err)} What it means
The child npm install process (run with execFile, --ignore-scripts) exited with an error while fetching the plugin package spec into the target install dir; the message embeds the underlying npm stderr/stdout as the cause.
Source
Thrown at server/src/services/plugin-loader.ts:1245
// npm install
const spec = version ? `${packageName}@${version}` : packageName!;
log.info(
{ spec, installDir: targetInstallDir },
"plugin-loader: fetching plugin from npm",
);
try {
// Use execFile (not exec) to avoid shell injection from package name/version.
// --ignore-scripts prevents preinstall/install/postinstall hooks from
// executing arbitrary code on the host before manifest validation.
await execFileAsync(
"npm",
["install", spec, "--prefix", targetInstallDir, "--save", "--ignore-scripts"],
{ timeout: 120_000 }, // 2 minute timeout for npm install
);
} catch (err) {
throw new Error(`npm install failed for ${spec}: ${String(err)}`);
}
// Resolve the package path after installation
const nodeModulesPath = path.join(targetInstallDir, "node_modules");
resolvedPackageName = packageName!;
// Handle scoped packages
if (resolvedPackageName.startsWith("@")) {
const [scope, name] = resolvedPackageName.split("/");
resolvedPackagePath = path.join(nodeModulesPath, scope!, name!);
} else {
resolvedPackagePath = path.join(nodeModulesPath, resolvedPackageName);
}
if (!existsSync(resolvedPackagePath)) {
throw new Error(
`Package directory not found after installation: ${resolvedPackagePath}`,
);View on GitHub (pinned to 120ae5428f)
Solutions
- Fix the npm install failure: verify the package spec exists, the registry is reachable, and credentials are configured; see the included error for details.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at server/src/services/plugin-loader.ts:1245 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/4e3a3ed898ab9668.
Report an issue: GitHub.