Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
johnneast opened this issue May 17, 2024 · 3 comments
Labels
needs review Issue is ready to be reviewed by a maintainer Router expo-router

Comments

@johnneast
Copy link

johnneast commented May 17, 2024

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

@johnneast johnneast added needs validation Issue needs to be validated Router expo-router labels May 17, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 17, 2024
@johnneast
Copy link
Author

I've added a commit where I've added the metro config for mono repos as recommended by the docs but the same error still occurs.

@sehgalrishabh
Copy link

facing similar issue.

@dzc0d3r
Copy link

dzc0d3r commented May 21, 2024

same
+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer Router expo-router
Projects
None yet
Development

No branches or pull requests

4 participants