pulumi/pulumi · error

installing dependencies failed: %w

Error message

installing dependencies failed: %w

What it means

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.

Source

Thrown at pkg/cmd/pulumi/policy/io.go:108

	)
	if err != nil {
		return err
	}
	defer pluginCtx.Close()

	lang, err := pluginCtx.Host.LanguageRuntime(pluginCtx, projRuntime.Name())
	if err != nil {
		return fmt.Errorf("failed to load language plugin %s: %w", projRuntime.Name(), err)
	}

	programInfo := plugin.NewProgramInfo(pluginCtx.Root, pluginCtx.Pwd, main, projRuntime.Options())
	err = pkgCmdUtil.InstallDependencies(pluginCtx.Request(),
		lang, plugin.InstallDependenciesRequest{
			Info:     programInfo,
			IsPlugin: true,
		}, stdout, stderr)
	if err != nil {
		return fmt.Errorf("installing dependencies failed: %w", err)
	}

	return nil
}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Run the package manager manually in the policy pack dir (`npm install` / `pip install -r requirements.txt`) to see the raw error.
  2. Fix dependency versions or add registry credentials in the package manager config.
  3. Verify network/VPN access to the package registry.
  4. Ensure the language toolchain version matches the policy pack requirements (e.g. engines field, python version).

Example fix

// before: install from a dir without package.json
cd /empty/dir && pulumi policy publish
// after: run where dependencies are declared
cd /path/to/policy-pack  # contains package.json
npm install && pulumi policy publish
Defensive patterns

Strategy: validation

Validate before calling

import fs from "fs";
const hasDeps = fs.existsSync("package.json") || fs.existsSync("requirements.txt") || fs.existsSync("go.mod");
if (!hasDeps) throw new Error("no dependency manifest found for policy pack");
// and dry-run the package manager first:
// npm install --dry-run  |  pip install -r requirements.txt --dry-run

Try / catch

try {
  await pulumiPolicyPublish();
} catch (err) {
  if (/installing dependencies failed/.test(err.message)) {
    console.error("Package manager failed; run npm/pip manually in the pack dir for the raw error.", err.cause);
  } else throw err;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/f85435d365bd18d6. Report an issue: GitHub.