Error running react-native start on project after expo eject - react-native

I just ejected my project from Expo using expo eject, and when I try to run it using react-native start, I get the following error message in my Terminal:
events.js:287
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (/usr/local/lib/node_modules/react-native/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (events.js:310:20)
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:133:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
I can't make out what I need to know to resolve this issue, so can someone point out the proper steps I should take to get my project running on react-native? Thanks!

Run the following in your command line to install watchman:
brew update
brew install watchman

try installing watchman - this improves on file watching capabilities of the react native packager server. see: https://facebook.github.io/watchman/

Related

React Native Error create new project ' Copying template '

when I'm try create new react native project
on macos Ventura 13.2
✔ Downloading template
✖ Copying template
error Error: Couldn't find the "/var/folders/mn/m8xhgjss2cj0jf5svmxg_2vm0000gn/T/rncli-init-template-VUPUIq/node_modules/react-native/template.config.js file inside "react-native" template. Please make sure the template is valid. Read more: https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template.
Error: Error: Couldn't find the "/var/folders/mn/m8xhgjss2cj0jf5svmxg_2vm0000gn/T/rncli-init-template-VUPUIq/node_modules/react-native/template.config.js file inside "react-native" template. Please make sure the template is valid. Read more: https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template
at createFromTemplate (/Users/imac/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/init/init.js:129:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.initialize [as func] (/Users/imac/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/init/init.js:181:3)
at async Command.handleAction (/Users/imac/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.
I have tried removing and reinstalling the following
sudo npm uninstall -g react-native-cli #react-native-community/cli
Nodejs
The problem has been fixed by updating the system to 13.2.1
Then execute
sudo npm uninstall -g react-native-cli #react-native-community/cli
npx react-native init AwesomeProject --npm

React Native - Command PhaseScriptExecution failed with a nonzero exit code

I'm getting this issue when I try to get archive.
I got react-native 0.63,
I got expo, expo-cli.
I tried to reinstall pod, removed nodule modules and reinstall etc.
what could be the solution?
info Writing bundle output to:, /Users/tufancagkansokmen/Library/Developer/Xcode/DerivedData/lastsisapp-gtlfysxutnqqnrbbwrcxtyldvttq/Build/Intermediates.noindex/ArchiveIntermediates/lastsisapp/BuildProductsPath/Release-iphoneos/lastsisapp.app/main.jsbundle
info Done writing bundle output
info Copying 76 asset files
info Done copying assets
+ [[ false != true ]]
+ [[ ! -f /Users/tufancagkansokmen/Library/Developer/Xcode/DerivedData/lastsisapp-gtlfysxutnqqnrbbwrcxtyldvttq/Build/Intermediates.noindex/ArchiveIntermediates/lastsisapp/BuildProductsPath/Release-iphoneos/lastsisapp.app/main.jsbundle ]]
Welcome to React Native!
Learn once, write anywhere
node:events:306
throw er; // Unhandled 'error' event
^
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:178:28)
Emitted 'error' event on NodeWatcher instance at:
at NodeWatcher.checkedEmitError (/Users/tufancagkansokmen/works/lastsis-app/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (node:events:329:20)
at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:184:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
Command PhaseScriptExecution failed with a nonzero exit code
try to reinstall watchman. For me this one worked.
brew reinstall watchman
But you can try also these.
brew update
brew install watchman
I had similar errors. Deleting yarn.lock file and running
yarn install
fixed the problem.

Unknown module '1298' in react-native

My react-native version is 0.52.During generating the build on actual iOS device I am constantly getting error requiring unknown module '1298'.If you are sure the module is there,try restarting metro bundler.Is there any way to solve this error?
Try running this command: react-native-link && npx jetify, and then, try again with npm start --reset-cache

Error While run react-native run-ios. Error: Cannot find module 'metro-config'

I am running React-native Project by terminal using react-native run-is command. I want to run it in simulator. first I run npm install ,then react-native run-ios. It showing error
Error: Cannot find module 'metro-config'
Require stack:
- /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/util/Config.js
- /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/core/index.js
- /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/cliEntry.js
- /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/cli.js
- /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/cli.js
- /usr/local/lib/node_modules/react-native-cli/index.js
You seem to have no Metro-config module installed. Install this module.
npm i metro-config --save-dev

How to fix error in "Copying template" when making project?

I'm generating a new project using React-Native in Command Prompt but I get an error when I use the following command:
react-native init Style
This is the result I get:
√ Downloading template
× Copying template
error Error: Cannot find module 'C:\Users\User\AppData\Local\Temp\rncli-init-template-srEvW0\node_modules\react-native\template.config'
error EBUSY: resource busy or locked, rmdir 'D:\FUSI\React Native\Style'. Run CLI with --verbose flag for more details.
Error: EBUSY: resource busy or locked, rmdir 'D:\FUSI\React Native\Style'
at Object.rmdirSync (fs.js:684:3)
at rmdirSync (D:\FUSI\React Native\node_modules\fs-extra\lib\remove\rimraf.js:276:13)
at Object.rimrafSync [as removeSync] (D:\FUSI\React Native\node_modules\fs-extra\lib\remove\rimraf.js:252:7)
at Object.initialize [as func] (D:\FUSI\React Native\node_modules\react-native\node_modules#react-native-community\cli\build\commands\init\init.js:295:26)
at process._tickCallback (internal/process/next_tick.js:68:7)
How can I fix this error?
Mustafa AK had it right. What worked for me is adding the --npm flag at the end of the command.
I followed the tutorial exactly how it was laid out on the React website and was running into the same error. For whatever reason, if you have yarn and npm installed the command to create a new project will not work. So you have to add the --npm flag to get it to only use npm and this will work.
npx react-native init AwesomeProject --npm
This Same error comes with me. But I solved by following ways...
First, uninstall the node from your system and download the latest version of node and install it.
2.after installation of the latest version of node you need to write the command in your command prompt
npm install -g react-native-cli
Now go to your project directory
cd your-react-native-project directory
now create your react-native project
react-native init your-project-name.
https://stackoverflow.com/a/71725307/16114216
Be sure uninstall global react-native/cli as described react-native tutorials
Try to use --npm end of init command if you had yarn and npm both.
npx react-native init MyApp --template react-native-template-typescript --npm
Note: If you have both yarn and npm installed on your machine, React Native CLI will always try to use yarn, so even if you use npx utility, only react-native executable will be installed using npm and the rest of the work will be delegated to yarn. You can force usage of npm adding --npm flag to the command.