Setting up the connection between my emulator on Android Studio and Visual Studio Code on Mac.
As I tried to run my first React native app on an Android device I faced some difficulties initializing the app.
When I ran the code "npx react-native run-android" I got the following error:
"node:events:497 throw er; // Unhandled 'error' event ^
Error: EMFILE: too many open files, watch at FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)
Emitted 'error' event on NodeWatcher instance at: at FSWatcher._checkedEmitError (/Users/cleitonpires/ReactNative/FirstProject01/node_modules/metro-file-map/src/watchers/NodeWatcher.js:82:12) at FSWatcher.emit (node:events:519:28) at FSWatcher._handle.onchange (node:internal/fs/watchers:213:12)
{
errno: -24, syscall: 'watch', code: 'EMFILE', filename: null
}
Node.js v20.16.0
Process terminated. Press to close the window"
I solved this error by installing Watchman, and by Modifying the .watchmanconfig
File to alter the configuration. Example:
{
"max_depth": 10
}
After that, I only had to specify the SDK path on my local.properties file.
This issue was solved by setting up the ANDROID_HOME
Environment Variable and then by running the code:
"npx react-native start --reset-cache"
Subscribe to my newsletter
Read articles from Cleiton directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by