fix: resolve hoisted tsc binaries#944
Open
mrousavy wants to merge 1 commit into
Open
Conversation
satya164
requested changes
Jun 1, 2026
Member
satya164
left a comment
There was a problem hiding this comment.
Thanks for the PR
Few concerns:
- it'd be good to limit how much we traverse up, e.g., by checking the presence of a known lockfile to identify monorepo root
- otherwise it may traverse up till
~/node_modules/.bin- which would be unexpected, especially because the warning isn't printed with such lookup
- otherwise it may traverse up till
- iirc most package managers add binaries to
PATH- I'm curious why it's not getting picked up by
which. it may be becausetypescriptisn't specified in the library'sdevDependencies - in case it's not in the immediate
node_modules/.binand the package manager is adding it toPATH, the latter would be a more appropriate pick
- I'm curious why it's not getting picked up by
I think the appropriate workflow is to add typescript to devDependencies of the package in your project, but we can add manual lookup as well, given:
- lookup is bound to monorepo root (or we have a warning similar to the current
whichwarning if it's found outside monorepo root) - optionally prioritize
PATHovernode_modules/.binlookup (package manager knows better than manual lookup) - in both cases, we can identify monorepo root with the lockfile approach, and print a warning if the found path was outside so we have proper warning about incorrect setups
- for tests, let's move it to
__tests__folder and usemock-fs(which is already present) if possible
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
Resolve the TypeScript compiler binary by walking up ancestor
node_modules/.bindirectories before falling back toPATH.This fixes package builds in workspaces where package dependencies are hoisted to the repository root, such as Bun workspaces. Previously Bob only checked
<package>/node_modules/.bin/tsc, so a package with hoisted TypeScript could fail even thoughtypescriptwas installed in the workspace.Validation
PATH="/Users/mrousavy/.nvm/versions/node/v24.16.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin:/Users/mrousavy/.codex/tmp/arg0/codex-arg0piPym5:/opt/homebrew/opt/binutils/bin:/Users/mrousavy/.nvm/versions/node/v20.19.4/bin:/Users/mrousavy/.rbenv/shims:/opt/homebrew/opt/openjdk@17/bin:/Users/mrousavy/Library/Android/sdk/emulator:/Users/mrousavy/Library/Android/sdk/tools:/Users/mrousavy/Library/Android/sdk/tools/bin:/Users/mrousavy/Library/Android/sdk/platform-tools:/Applications/Codex.app/Contents/Resources" yarn workspace react-native-builder-bob test runPATH="/Users/mrousavy/.nvm/versions/node/v24.16.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin:/Users/mrousavy/.codex/tmp/arg0/codex-arg0piPym5:/opt/homebrew/opt/binutils/bin:/Users/mrousavy/.nvm/versions/node/v20.19.4/bin:/Users/mrousavy/.rbenv/shims:/opt/homebrew/opt/openjdk@17/bin:/Users/mrousavy/Library/Android/sdk/emulator:/Users/mrousavy/Library/Android/sdk/tools:/Users/mrousavy/Library/Android/sdk/tools/bin:/Users/mrousavy/Library/Android/sdk/platform-tools:/Applications/Codex.app/Contents/Resources" yarn typecheckPATH="/Users/mrousavy/.nvm/versions/node/v24.16.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin:/Users/mrousavy/.codex/tmp/arg0/codex-arg0piPym5:/opt/homebrew/opt/binutils/bin:/Users/mrousavy/.nvm/versions/node/v20.19.4/bin:/Users/mrousavy/.rbenv/shims:/opt/homebrew/opt/openjdk@17/bin:/Users/mrousavy/Library/Android/sdk/emulator:/Users/mrousavy/Library/Android/sdk/tools:/Users/mrousavy/Library/Android/sdk/tools/bin:/Users/mrousavy/Library/Android/sdk/platform-tools:/Applications/Codex.app/Contents/Resources" yarn lint