expo: Web Bundling failed. Unable to resolve "expo-router/entry" from "index.ts"
Summary
I was install expo with this command pnpm create expo-app --template. I selected the natigation template. After the installation was completed. I ran npx expo start for web mode i pressed “w”. Then I’m getting this error
Web Bundling failed 17ms
Unable to resolve "expo-router/entry" from "index.ts"
What platform(s) does this occur on?
Web
SDK Version
No response
Environment
expo-env-info 1.0.5 environment info: System: OS: Linux 5.4 Ubuntu 20.04.5 LTS (Focal Fossa) Shell: 5.0.17 - /bin/bash Binaries: Node: 19.7.0 - ~/nvm/current/bin/node Yarn: 1.22.19 - /usr/bin/yarn npm: 9.5.0 - ~/nvm/current/bin/npm npmPackages: expo: ~48.0.9 => 48.0.9 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.71.4 => 0.71.4 react-native-web: ~0.18.10 => 0.18.12 npmGlobalPackages: expo-cli: 6.3.2 Expo Workflow: managed
Minimal reproducible example
Web Bundling failed. Unable to resolve “expo-router/entry” from “index.ts”
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 14
- Comments: 22 (4 by maintainers)
another option to use pnpm:
.npmrcin your project rootnode-linker=hoistedto the file and save itpnpm-lock.yamlandnode_modules, runpnpm installagainReact Native is a popular framework for building mobile applications using JavaScript. It allows developers to write code once and deploy it on multiple platforms, such as iOS and Android. On the other hand, pnpm is a package manager for JavaScript projects that aims to provide faster installation and better disk space utilization compared to other package managers like npm or Yarn.
While React Native and pnpm can be used together in a project, there have been reported compatibility issues between React Native’s build process and pnpm. These issues stem from the fact that React Native heavily relies on native modules and requires a specific project structure and dependency resolution.
Here are a few reasons why React Native may not work seamlessly with pnpm:
Native modules: React Native relies on native modules written in Java (for Android) and Objective-C/Swift (for iOS). These native modules often have their own dependencies and may require specific configurations. Some native modules may not be fully compatible with pnpm’s resolution algorithm, which can lead to build errors or runtime issues.
Project structure: React Native expects a specific project structure, including the “node_modules” directory at the root of the project. However, pnpm uses a different approach to manage dependencies, which may result in inconsistencies with React Native’s expectations. This can cause issues during the build process or when bundling assets.
Tooling integration: React Native has a well-defined tooling ecosystem, including its own CLI (Command Line Interface) and build scripts. These tools are designed to work with npm or Yarn by default, and their integration with pnpm may not be as seamless. This can lead to compatibility issues or the need for additional configuration.
While it’s possible to use React Native with pnpm by configuring the project and build processes accordingly, it may require additional effort and troubleshooting to overcome any compatibility issues that arise. It’s important to consider the specific needs of your project and evaluate the trade-offs before deciding to use pnpm with React Native.
this is what helped me:
https://github.com/t3-oss/create-t3-turbo/issues/741#issuecomment-1812454342
https://github.com/t3-oss/create-t3-turbo/issues/741#issuecomment-1812454342
I was also trying to resolve
I did set my Node Version onto 16.10 After looking here: https://expo.github.io/router/docs/ I’ve ran: npx expo install expo-router react-native-safe-area-context react-native-screens expo-linking expo-constants expo-status-bar
Please let me know if it helped you
Leaving this hear in case anyone else is stuck at the same error but without any clear help:
npx expo install --checkfixed things up for meEdit: this fixed it for me
Adding mjs will accept files using esm and package exports will enable the react-native exports field in package.json.
não entendi
One super-tricky reason this happens: if you name your repo the same name as a node_module Metro is trying to import.
I’ve named my example apps
expoorexpo-routera few times, and I get this mysterious error that it can’t find a dependency. Metro seems to do a lookup at the root directory for some reason if it matches a dependency name.I am still receiving this error for web bundler… I am trying to use effector and effector-react… the problem was first occurring for effector-react… simply removed it, then the problem became for effector… so it had to be the bundler I guess?
Web Bundling failed ....ms Unable to resolve "effector-react" from "...."Web Bundling failed ....ms Unable to resolve "effector" from "...."RN is fine - the apps work well - its just the web
Thank you. This worked for me!
i get this error: Android Bundling failed 11284ms Unable to resolve “./effects” from “node_modules@expo\metro-runtime\build\index.js”
I tried reinstalling expo-router, then I got
Unable to resolve “react-native-safe-area-context” from “node_modules\expo-router\src\ExpoRoot.tsx”
while using the with-typescript template.