Metro cannot resolve packages whose realpath is in the global virtual store #1294
Replies: 1 comment
|
Confirmed and fixed in #1297. I reproduced this with aube 1.40.0, Node 24.19.0, and Metro 0.84.4. The GVS layout fails exactly as described, while per-project materialization, hoisted mode, and adding the realpath to The PR adds One caveat: explicit Thanks for the thorough repro and comparison matrix. AI-assisted — Tool: Codex; model: unavailable; version: unavailable. |
Uh oh!
There was an error while loading. Please reload this page.
metro-gvs-package-resolve1.40.0 linux-x64 (2026-08-13)v24.19.00.84.411.21.0Summary
Isolated aube with the default-on global virtual store links
node_modules/<pkg>to$XDG_CACHE_HOME/aube/virtual-store/.... Node resolves that package. Metro 0.84.4 does not.I first hit this in an Expo 56 app as
Unable to resolve "expo/virtual/env"afterbabel-preset-expoinjected that import. The reduced case does not need Expo. Metro fails onis-numberitself once the package realpath is outsideprojectRoot/watchFolders.This looks like the same GVS incompatibility that
disableGlobalVirtualStoreForPackagesalready handles fornext,nuxt,vite,vitepress, andparcel.metro,expo, andreact-nativeare not on that list.Expected
After
aube install --node-linker=isolated --enable-global-virtual-store,Metro.buildGraphresolvesis-numberthe same way Node does.Actual
Node resolves the package through the GVS realpath. Metro reports:
Pointing
resolver.extraNodeModules.is-numberat the GVS realpath makes Metro list that path and still fail. Adding the same realpath towatchFoldersmakes Metro succeed.Repro
git clone https://github.com/mwolson/tmp-aube-issues cd tmp-aube-issues/metro-gvs-package-resolve ./repro.shrepro.shexits non-zero when the issue is present. It also checks the comparisons below and treats unexpected comparison failures as setup errors.Comparisons
aube install --node-linker=isolated --disable-global-virtual-store: realpath stays undernode_modules/.aube/. Metro succeeds.AUBE_NODE_LINKER=hoisted aube install: hoisted mode writes a realnode_modules/is-numberdirectory. Metro succeeds.11.21.0isolated: realpath stays undernode_modules/.pnpm/. Metro succeeds.enableGlobalVirtualStore=true: realpath leaves the project and Metro fails the same way.So this is Metro's file map plus a virtual store that lives outside the project. aube turns that store on by default for local isolated installs. pnpm leaves it off.
aubeshim is not required. I reproduced with
aubedirectly.Docs I checked
Metro's own note: symlink targets inside
watchFoldersmust also be insidewatchFolders.Related aube work: #32 and #101 added the auto-disable list. #117 later dropped names that had no concrete walk-up repro. #754 is isolated config-loader resolution, not this file-map miss.
Ask
Please add
expo,react-native, andmetroto the defaultdisableGlobalVirtualStoreForPackageslist.The matcher is exact and only looks at direct dependencies. A typical Expo app declares
expoandreact-native, notmetro.metrostill belongs on the list for apps that depend on it directly.Until then,
enableGlobalVirtualStore=falseornode-linker=hoistedkeeps the realpath inside the project. A MetrowatchFoldersentry for the GVS realpath also works, but those store paths are content-hashed and change between installs, so they are awkward to keep inmetro.config.js.All reactions