{"record":{"id":"f85435d365bd18d6","repo":"pulumi/pulumi","slug":"installing-dependencies-failed-w","errorCode":null,"errorMessage":"installing dependencies failed: %w","messagePattern":"installing dependencies failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/policy/io.go","lineNumber":108,"sourceCode":"\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer pluginCtx.Close()\n\n\tlang, err := pluginCtx.Host.LanguageRuntime(pluginCtx, projRuntime.Name())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load language plugin %s: %w\", projRuntime.Name(), err)\n\t}\n\n\tprogramInfo := plugin.NewProgramInfo(pluginCtx.Root, pluginCtx.Pwd, main, projRuntime.Options())\n\terr = pkgCmdUtil.InstallDependencies(pluginCtx.Request(),\n\t\tlang, plugin.InstallDependenciesRequest{\n\t\t\tInfo:     programInfo,\n\t\t\tIsPlugin: true,\n\t\t}, stdout, stderr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"installing dependencies failed: %w\", err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":90,"sourceCodeEnd":113,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/policy/io.go#L90-L113","documentation":"Once the language plugin is loaded, InstallPluginDependencies invokes pkgCmdUtil.InstallDependencies to install the policy pack's dependencies (npm/pip/etc.). Any failure from that installation step is wrapped as \"installing dependencies failed\", with the underlying cause describing the package manager's error.","triggerScenarios":"pkgCmdUtil.InstallDependencies returns an error while installing dependencies for a policy pack, e.g. npm/yarn/pip exits non-zero, no lockfile/network, or the language runtime's install hook fails (pkg/cmd/pulumi/policy/io.go:108).","commonSituations":"package.json/requirements.txt references unavailable packages; no network access or private registry auth missing; wrong Node/Python version for the dependencies; package manager not installed on the machine.","solutions":["Run the package manager manually in the policy pack dir (`npm install` / `pip install -r requirements.txt`) to see the raw error.","Fix dependency versions or add registry credentials in the package manager config.","Verify network/VPN access to the package registry.","Ensure the language toolchain version matches the policy pack requirements (e.g. engines field, python version)."],"exampleFix":"// before: install from a dir without package.json\ncd /empty/dir && pulumi policy publish\n// after: run where dependencies are declared\ncd /path/to/policy-pack  # contains package.json\nnpm install && pulumi policy publish","handlingStrategy":"validation","validationCode":"import fs from \"fs\";\nconst hasDeps = fs.existsSync(\"package.json\") || fs.existsSync(\"requirements.txt\") || fs.existsSync(\"go.mod\");\nif (!hasDeps) throw new Error(\"no dependency manifest found for policy pack\");\n// and dry-run the package manager first:\n// npm install --dry-run  |  pip install -r requirements.txt --dry-run","typeGuard":null,"tryCatchPattern":"try {\n  await pulumiPolicyPublish();\n} catch (err) {\n  if (/installing dependencies failed/.test(err.message)) {\n    console.error(\"Package manager failed; run npm/pip manually in the pack dir for the raw error.\", err.cause);\n  } else throw err;\n}","preventionTips":["Commit lockfiles and install dependencies before running policy commands.","Ensure registry credentials/network are available in CI.","Match local language toolchain versions to the pack's requirements."],"tags":["policy","dependencies","package-manager","npm","python"],"backgroundTag":"dependency-install-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}