Skip to content

fix(make): expo-doctor always fails on duplicate-deps check (Bun .bun cache layout false positives) #389

Description

@masch

Pre-flight Checks

  • I have searched existing issues and this is not a duplicate
  • This issue is scoped: document the failure and define the fix, to be implemented later

Bug Description

make expo-doctor always fails (exit 1) with the "Check that no duplicate dependencies are installed" check. Every duplicate reported is the same version of the same package, installed in multiple physical locations by Bun's workspace cache layout (node_modules/.bun/<pkg>@<version>+<hash>/...). Expo Doctor's autolinking duplicate check treats each cache copy as a distinct installation.

Steps to Reproduce

  1. Clone the repo and run bun install at the workspace root
  2. Run make expo-doctor (or cd apps/mobile && bunx expo-doctor)
  3. Observe: 20/21 checks passed. 1 checks failed and exit code 1

Expected Behavior

make expo-doctor passes (exit 0) when the only "duplicates" are the same-version copies created by the Bun cache layout, and fails only for real version conflicts.

Actual Behavior

Fails on duplicate detection for: @expo/ui, expo, expo-asset, expo-constants, expo-file-system, expo-font, expo-glass-effect, expo-linking, expo-symbols, react-native, @expo/dom-webview, @expo/fingerprint, @expo/log-box, expo-modules-core, expo-modules-jsi.

Example output:

✖ Check that no duplicate dependencies are installed
Found duplicates for expo:
  ├─ expo@56.0.18 (at: node_modules/expo)
  │  └─ linked to: ../../node_modules/.bun/expo@56.0.18+b59826b516f43db8/node_modules/expo
  ├─ expo@56.0.18 (at: ../../node_modules/.bun/expo-keep-awake@56.0.3+4c7ef341795ca0da/node_modules/expo)
  └─ expo@56.0.18 (at: ../../node_modules/.bun/expo-router@56.2.17+c5019fc39a4b1b18/node_modules/expo)

Impact

  • The expo-doctor Makefile target is effectively dead: it cannot pass on this repo
  • make check already works around it with $(MAKE) expo-doctor || echo "[WARN] expo-doctor checks failed (may be false positives from bun cache layout)" (Makefile ~line 859), so real regressions in this check are silently swallowed
  • EXPO_NO_DOCTOR=1 is exported in the Makefile (line 25) to bypass the same check during EAS local builds

Root Cause (analysis)

Bun hoists dependencies per-package into node_modules/.bun/ with content hashes. Expo Doctor's AutolinkingDependencyDuplicatesCheck scans native module resolutions and flags these same-version copies as duplicates. The check source includes a regex to ignore bun/pnpm cache paths (/node_modules[\\/]\.(?:bun|pnpm)[\\/]/), but the reported duplicates still surface — the ignore logic does not cover this Bun layout.

Possible Fix Directions (to evaluate when implementing)

  1. Dedup in Bun config: bunfig.toml options (dedupe, linker = "hoisted" / isolated) to avoid same-version copies under .bun/
  2. Reinstall from scratch: rm -rf node_modules apps/*/node_modules bun.lock* && bun install — verify duplicates persist
  3. Upstream: report to expo-doctor that the .bun cache-layout ignore regex is insufficient (expo-doctor 1.20.1 is the latest at time of writing)
  4. Makefile: if upstream can't fix, make the target skip only the duplicate-deps check explicitly rather than swallowing all failures with || echo

Environment

  • Bun: 1.3.14
  • expo-doctor: 1.20.1
  • Expo SDK: 56 (expo@56.0.18), expo-router 56.2.17
  • OS: Linux (Fedora Silverblue / distrobox)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtype:choreMaintenance or tooling changes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions