Symlink the active nvm Node binaries into /usr/local/bin - #24
Merged
Conversation
The node Feature installs via nvm, which only reaches PATH through /etc/profile.d or shell rc files sourced by a login shell — neither Claude Code's Bash tool, a GitHub Actions step, nor `docker run ... bash -c` is one, so plain `node`/`npm` silently resolved to whatever older version happened to already be on the default PATH (18.19.1, the apt-based bootstrap this same script installs first to get npm working at all) instead of the pinned 22. Same class of bug the dotnet wrapper below already exists for, just never extended to node. Confirmed by building the image locally: node stayed at 18.19.1 despite the node Feature installing 22 successfully via nvm. Symlinks node/npm/npx/corepack from nvm's `current` (a stable, version-tracking symlink) into /usr/local/bin, which already takes precedence over /usr/bin in the default PATH - no wrapper script needed since node requires no extra env var at run time, unlike dotnet needing DOTNET_ROOT. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PeQipf4QUFGFaVceX8NcEP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Found while verifying the pre-built image end-to-end in a real Docker daemon:
node --versionreported
18.19.1(the apt-based bootstrapinstall-features.shinstalls first just to getnpmworking), not the pinned
22fromdevcontainer.features.json, even though thenodeFeature'sown
install.shcompletes successfully and installs 22 vianvmwithout error.Root cause:
nvmonly reachesPATHthrough/etc/profile.dor shell rc files sourced by alogin shell. Neither Claude Code's Bash tool, a GitHub Actions step, nor
docker run ... bash -cis one — same class of bug the existinglink_dotnet_wrappermechanism already exists to workaround for
dotnet/pac/txc, just never extended tonode.Fix: symlink
node/npm/npx/corepackfrom nvm'scurrent(a stable, version-trackingsymlink nvm maintains) into
/usr/local/bin, which already takes precedence over/usr/bininthe default
PATH— no wrapper script needed since node requires no extra env var at run time,unlike
dotnetneedingDOTNET_ROOT.Verification
Built the current Dockerfile locally end-to-end (fresh,
--no-cache) and confirmed in a runningcontainer:
node --version→v18.19.1,which node→/usr/bin/node.node --version→v22.23.2,npm --version→10.9.8, both resolving via/usr/local/bin/.dotnet,az,pwsh,terraform,gh,copilot,func,pac,txc)confirmed working,
DOTNET_ROOTcorrectly wired,pac/txcwork with no PATH hacks, and thepac/txcauto-update marker files are present.Generated by Claude Code