Skip to content

fix: source nvm in playwright install script so npx is on PATH#86

Merged
schlich merged 1 commit intoschlich:mainfrom
kohanyirobert:fix/playwright-npx-path
Mar 30, 2026
Merged

fix: source nvm in playwright install script so npx is on PATH#86
schlich merged 1 commit intoschlich:mainfrom
kohanyirobert:fix/playwright-npx-path

Conversation

@kohanyirobert
Copy link
Copy Markdown
Contributor

Problem

When the playwright feature runs its install.sh during container build, npx is not found even when the node feature is listed as a dependency.

Root cause: The node feature adds /usr/local/share/nvm/current/bin to PATH via containerEnv. However, containerEnv is applied to the running container, not to feature install scripts during image build. So npx is never on PATH when playwright's install script executes.

This affects users who add the playwright feature alongside an explicit node feature, or rely on the dependsOn: node declared in devcontainer-feature.json — the install order is correct, but the PATH is still missing.

Fix

Source nvm.sh at the top of install.sh before calling npx. The su invocation (for non-root installs) also re-sources nvm since it starts a fresh shell environment.

🤖 Generated with Claude Code

@kohanyirobert
Copy link
Copy Markdown
Contributor Author

One extra note is that I use mcr.microsoft.com/devcontainers/base:ubuntu24.04 as my base image, node is not installed by default in Dockerfile. If node is already baked in the existing feature works, but I think that's not how it should work.

@schlich schlich merged commit 3efbdf7 into schlich:main Mar 30, 2026
9 checks passed
@schlich
Copy link
Copy Markdown
Owner

schlich commented Mar 30, 2026

thanks for the fix @kohanyirobert ! releasing a new version with the fix in just a moment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants