fix: prefer local node_modules/.bin executables to globally installed ones#87
Merged
43081j merged 2 commits intotinylibs:mainfrom Mar 4, 2026
Merged
Conversation
iiroj
commented
Mar 3, 2026
fa2c80d to
ff4ab6e
Compare
Contributor
Author
|
Changing this behavior might be seen as a breaking change, so it could be released with a new option like |
…ed ones Previously the local `node_modules/.bin` paths, resolved from the current working directory all the way to the root directory, were added to the end of the `PATH` variable when spawning a binary. This meant that if a binary was installed both to a default global path like `/usr/local/bin` as well as a local directory like `~/node_modules/.bin`, the globally installed binary was spawned instead of the local one. Now the the `node_modules/.bin` paths are prefixed to the **start of `PATH`** instead, so that locally-installed binaries are preferred to global ones. This mirrors the behavior of `npm`/`npx` path resolution when running scripts.
ff4ab6e to
25b52a6
Compare
Member
|
im not sure about the semver yet. this is a bug really rather than a breaking change, but i understand it could break things... ill have a think 🤔 |
Contributor
Author
|
My personal opinion would be to treat it as a bugfix and refer to how npm handles it, and if someone absolutely requires it maybe an option that restores the previous behavior. 👍 |
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.
Previously the local
node_modules/.binpaths, resolved from the current working directory all the way to the root directory, were added to the end of thePATHvariable when spawning a binary. This meant that if a binary was installed both to a default global path like/usr/local/binas well as a local directory like~/node_modules/.bin, the globally installed binary was spawned instead of the local one.Now the the
node_modules/.binpaths are prefixed to the start ofPATHinstead, so that locally-installed binaries are preferred to global ones. This mirrors the behavior ofnpm/npxpath resolution when running scripts.