fix: only inject portless Node dir into PATH on Windows#247
Open
octo-patch wants to merge 1 commit intovercel-labs:mainfrom
Open
fix: only inject portless Node dir into PATH on Windows#247octo-patch wants to merge 1 commit intovercel-labs:mainfrom
octo-patch wants to merge 1 commit intovercel-labs:mainfrom
Conversation
…-labs#241) On Unix-like systems (macOS/Linux), the user's version manager (nvm/fnm/asdf/mise) places their preferred Node binary first in PATH. Unconditionally prepending process.execPath's directory caused portless's own Node to shadow the user's chosen version, breaking tools that pin to a specific Node release. The nodeBin injection is only needed on Windows, where .cmd wrappers in node_modules/.bin require node to be findable via PATH. Restrict the injection to Windows so Unix users retain their version-manager Node. Co-Authored-By: Octopus <liyuan851277048@icloud.com>
|
Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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.
Fixes #241
Problem
augmentedPathincli-utils.tsunconditionally prependspath.dirname(process.execPath)to thePATHof every child process spawned by portless. When portless is installed via Homebrew (or any tool that uses its own Node), this places portless's Node binary directory before the user's PATH entries, shadowing the version they've configured through their version manager (nvm/fnm/asdf/mise).Example from the issue:
Solution
Restrict the
nodeBininjection to Windows only. The comment in the original code already explains it's a Windows-specific need —.cmdwrappers innode_modules/.binrequirenodeto be resolvable via PATH on Windows. On Unix-like systems (macOS/Linux), the user's version manager already places their preferred Node first in PATH, so adding portless's Node directory is both unnecessary and harmful.Testing
portless run sh -c 'node --version'now returns the user's version-manager Node, not portless's bundled Node..cmdwrappers innode_modules/.binstill findnodecorrectly.