You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Metro can't resolve transitive dependencies when using bun as package manager #1636
When using bun as package manager, Metro bundler cannot resolve transitive dependencies because bun stores them in node_modules/.bun/ rather than hoisting them to node_modules/.
Create an Expo project using bun as package manager
Have code that imports a transitive dependency (e.g., promise which is a dependency of react-native)
Run expo run:ios or expo start
Expected behavior
Metro should be able to resolve promise since it's a dependency of react-native which is installed.
Actual behavior
Unable to resolve module promise/setimmediate/rejection-tracking from /path/to/file.ts:
promise/setimmediate/rejection-tracking could not be found within the project or in these directories:
node_modules
../node_modules
The package exists at node_modules/.bun/promise@8.3.0/node_modules/promise but Metro doesn't look there.
Workaround
Add transitive dependencies as direct dependencies in package.json:
"promise": "^8.3.0"
Environment
bun: 1.x
expo: 54.0.30
react-native: 0.81.5
Possible solutions
Metro could be configured to also look in node_modules/.bun/
Expo/RN could list commonly-needed transitive deps like promise as peerDependencies
Documentation warning about bun compatibility
Notes
This differs from npm/yarn behavior where transitive dependencies are hoisted to root node_modules/ and are resolvable by any package. Bun is increasingly popular so this may affect more users.
Activity