Skip to content

[Feature Request]: pnpm feature: declare containerEnv so PNPM_HOME / PATH are available to non-interactive shells #218

Description

@alexsapps

Requested Feature

The pnpm feature configures PNPM_HOME and PATH only by appending exports to shell rc files (.bashrc, .zshrc, .profile). This works for interactive terminals but means pnpm is not on PATH inside non-interactive /bin/sh -c invocations — including devcontainer lifecycle scripts (onCreateCommand, postCreateCommand, etc.) and other features' lifecycle hooks.

Proposed fix: Have the feature declare containerEnv in its devcontainer-feature.json so the values are baked into the image and inherited by every shell — interactive or not:

"containerEnv": {
  "PNPM_HOME": "/home/<user>/.local/share/pnpm",
  "PATH": "/home/<user>/.local/share/pnpm/bin:${PATH}"
}

I'm hoping this will help me use this feature in combination with mount-pnpm-store:

"features": {
		"ghcr.io/joshuanianji/devcontainer-features/mount-pnpm-store:1": {},
		"ghcr.io/devcontainers-extra/features/pnpm:2": {},
}

Currently I cannot use these two together without adding this in my own devcontainer.json

"remoteEnv": {
	"PNPM_HOME": "/home/vscode/.local/share/pnpm",
	"PATH": "/home/vscode/.local/share/pnpm/bin:${containerEnv:PATH}"
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions