Skip to content

[SDK 51] Project created with expo-router entry not accessable via web in monorepo #28940

Closed
@johnneast

Description

@johnneast

Minimal reproducible example

https://github.com/johnneast/expo-turbo-repo

Which package manager are you using? (Yarn is recommended)

yarn

If the issue is web-related, please select the bundler (web.bundler in the app.json)

metro

Summary

When creating a brand new expo app in a monorepo (in this case created by turborepo), the metro bundler for the app does not work, so running yarn web in the app folder results in the following error:

λ .expo/static/render.js ░░░░░░░░░░░░░░░░  0.0% (0/1)Error: ENOENT: no such file or directory, open '/Users/johneast/src/scratch/my-turborepo/node_modules/@expo/server/src/index.ts'
    at Object.readFileSync (node:fs:457:20)
    at getCodeFrame (/Users/johneast/src/scratch/my-turborepo/node_modules/metro/src/Server.js:868:18)
    at Server._symbolicate (/Users/johneast/src/scratch/my-turborepo/node_modules/metro/src/Server.js:945:22)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Server._processRequest (/Users/johneast/src/scratch/my-turborepo/node_modules/metro/src/Server.js:394:7) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/johneast/src/scratch/my-turborepo/node_modules/@expo/server/src/index.ts'
}
Error: ENOENT: no such file or directory, open '/Users/johneast/src/scratch/my-turborepo/node_modules/@expo/server/src/vendor/http.ts'
    at Object.readFileSync (node:fs:457:20)
    at getCodeFrame (/Users/johneast/src/scratch/my-turborepo/node_modules/metro/src/Server.js:868:18)
    at Server._symbolicate (/Users/johneast/src/scratch/my-turborepo/node_modules/metro/src/Server.js:945:22)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Server._processRequest (/Users/johneast/src/scratch/my-turborepo/node_modules/metro/src/Server.js:394:7) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/johneast/src/scratch/my-turborepo/node_modules/@expo/server/src/vendor/http.ts'
}

Metro error: Unable to resolve module ./node_modules/expo-router/entry from /Users/johneast/src/scratch/my-turborepo/apps/app1/.: 

None of these files exist:
  * node_modules/expo-router/entry(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)
  * node_modules/expo-router/entry/index(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)

Reproducing

The above can be reproduced by simply creating a new monorepo and then creating a new expo app.

yarn create turbo
cd my-turborepo
yarn create expo
# app created at apps/app1
cd apps/app1
yarn web

The above errors will be out to the console.

The app works fine in Expo Go.

Creating an expo app in the monorepo that does not use expo-router (index.js in the route of the project etc) works as expected.

building the app and deploying the dist folder works as expected.

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.4.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.2 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 10.5.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
IDEs:
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
react-native-web: ~0.19.10 => 0.19.11
Expo Workflow: managed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions