{"record":{"id":"4e3a3ed898ab9668","repo":"paperclipai/paperclip","slug":"npm-install-failed-for-spec-string-err","errorCode":null,"errorMessage":"npm install failed for ${spec}: ${String(err)}","messagePattern":"npm install failed for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/plugin-loader.ts","lineNumber":1245,"sourceCode":"      // npm install\n      const spec = version ? `${packageName}@${version}` : packageName!;\n\n      log.info(\n        { spec, installDir: targetInstallDir },\n        \"plugin-loader: fetching plugin from npm\",\n      );\n\n      try {\n        // Use execFile (not exec) to avoid shell injection from package name/version.\n        // --ignore-scripts prevents preinstall/install/postinstall hooks from\n        // executing arbitrary code on the host before manifest validation.\n        await execFileAsync(\n          \"npm\",\n          [\"install\", spec, \"--prefix\", targetInstallDir, \"--save\", \"--ignore-scripts\"],\n          { timeout: 120_000 }, // 2 minute timeout for npm install\n        );\n      } catch (err) {\n        throw new Error(`npm install failed for ${spec}: ${String(err)}`);\n      }\n\n      // Resolve the package path after installation\n      const nodeModulesPath = path.join(targetInstallDir, \"node_modules\");\n      resolvedPackageName = packageName!;\n\n      // Handle scoped packages\n      if (resolvedPackageName.startsWith(\"@\")) {\n        const [scope, name] = resolvedPackageName.split(\"/\");\n        resolvedPackagePath = path.join(nodeModulesPath, scope!, name!);\n      } else {\n        resolvedPackagePath = path.join(nodeModulesPath, resolvedPackageName);\n      }\n\n      if (!existsSync(resolvedPackagePath)) {\n        throw new Error(\n          `Package directory not found after installation: ${resolvedPackagePath}`,\n        );","sourceCodeStart":1227,"sourceCodeEnd":1263,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/plugin-loader.ts#L1227-L1263","documentation":"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.","triggerScenarios":"Thrown at server/src/services/plugin-loader.ts:1245 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}