You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Metro error "Unable to resolve module ... could not be found within the project or in these directories: node_modules" even if the file exists in node_modules
#1431
Open
lucaskraus opened this issue
Jan 21, 2025
· 2 comments
I'm facing a error with my Expo application when building the web version. Since the new SDK 52 version, I'm trying to add the Reown React package to my application. The Expo SDK 52 allow us to add DOM Components which is components based on React jsx/tsx.
But the error is not related to this. After all the basic setup of Reown, when I'm trying to initialize the application the following error is showing for me:
Metro error: Unable to resolve module @reown/appkit/networks from /home/lucas/code/Frontend/src/utils/web3/ReownConfig.tsx: @reown/appkit/networks could not be found within the project or in these directories: node_modules
3 | import { arbitrum, mainnet, AppKitNetwork } from "@reown/appkit/networks";
I have a similar issue on apps that are in mono repo: after upgrade to react-native 0.77, metro can't find node modules or packages within my repo
Here is 2 examples of metro config that don't work
const{getDefaultConfig}=require('expo/metro-config');constpath=require('path');// Find the project and workspace directoriesconstprojectRoot=__dirname;// This can be replaced with `find-yarn-workspace-root`constmonorepoRoot=path.resolve(projectRoot,'../..');constconfig=getDefaultConfig(projectRoot);// 1. Watch all files within the monorepoconfig.watchFolders=[monorepoRoot];// 2. Let Metro know where to resolve packages and in what orderconfig.resolver.nodeModulesPaths=[path.resolve(projectRoot,'node_modules'),path.resolve(monorepoRoot,'node_modules'),];module.exports=config;
I have tried many configurations (with projectRoot in app directory or root directory of the mono repo, unstable_serverRoot, watchFolders, nodeModulesPath ...) and in every cases I have an issue, with many adjustments (nodeModulesPath + resolvePath) I succeeded in fixing access to node modules and local packages, but finally I have an issue with relay (and .relayprovider file)
Is there any specific modification to be done on monorepo with react native 0.77 ?
Hi everyone!
I'm facing a error with my Expo application when building the web version. Since the new SDK 52 version, I'm trying to add the Reown React package to my application. The Expo SDK 52 allow us to add DOM Components which is components based on React jsx/tsx.
But the error is not related to this. After all the basic setup of Reown, when I'm trying to initialize the application the following error is showing for me:
Metro error: Unable to resolve module @reown/appkit/networks from /home/lucas/code/Frontend/src/utils/web3/ReownConfig.tsx: @reown/appkit/networks could not be found within the project or in these directories: node_modules
Reown doc reference: https://docs.reown.com/appkit/react/core/installation
As you can see below, @reown/appkit/networks it's a perfect exported file from node_modules, I can see it there.
Here's my metro.config.js file:
And here's my babel.config.js file:
My environment information:
Thanks in advance!
The text was updated successfully, but these errors were encountered: