As I dive into my inaugural React Native project utilizing React Native with Expo, I find myself faced with a vexing predicament. While the project functions smoothly on the Expo Go app on my Android device, attempting to access it through a web browser on my Windows laptop triggers the subsequent error:
Metro error: Cannot find module 'react'
Require stack:
- /C:%5CUsers%5CMuhammed%20Tauqeer%20Ali%5CSocialSphere%5Cnode_modules%5Cexpo-router%5Cnode%5Crender.js.bundle?platform=web&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app&resolver.environment=node&transform.environment=node&unstable_transformProfile=hermes-stable
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\@expo\cli\build\src\start\server\getStaticRenderFunctions.js
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\@expo\cli\build\src\start\server\metro\metroErrorInterface.js
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\@expo\cli\build\src\start\server\metro\createServerComponentsMiddleware.js
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\@expo\cli\build\src\start\server\metro\MetroBundlerDevServer.js
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\@expo\cli\build\src\start\server\DevServerManager.js
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\@expo\cli\build\src\start\startAsync.js
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\@expo\cli\build\src\start\index.js
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\@expo\cli\build\bin\cli
- C:\Users\Muhammed Tauqeer Ali\SocialSphere\node_modules\expo\bin\cli
Provided below is an image captured from the web browser:
https://i.sstatic.net/lxopnU9F.jpg
Multiple troubleshooting steps have been taken in these circumstances:
- Installed
react
andreact-dom
vianpm install react react-dom
. - Emptied the Metro Bundler cache using
npx expo start --clear
. - Executed
npx expo-doctor
, which yielded no indicators of errors or issues.
In addition to the aforementioned actions, I also experimented with methods found on various YouTube tutorials. Despite these dedicated efforts, the persisting error remains unyielding.