Errors when trying to run react-native on ios - react-native

so I developed an app in react-native, already runs and tested on Android, but now its the ios part.
I'm working with react native version 0.60.3, on MacOS, using yarn as package manager.
I'm running "react-native start --reset cache".
then running "react-native run-ios:" on a separate console,
and getting this error:
"
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening app.xcworkspace.
....
error: Unable to resolve build file: XCBCore.BuildFile (missingTargetProductReference(...))
"
so then im trying to run with Xcode and i get this error on the "react-native start --reset-cache" console:
"
Error: Unable to resolve module ./index from /Users/nono/work/myapp/.: The module ./index could not be found from /Users/nono/work/myapp/.. Indeed, none of these files exist:
* /Users/nono/work/app/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
"
and this error on the iphone simulator :
I'm desperate ... please help!
UPDATE:
now the first error doesn’t occur.
I only get the "Unable to resolve './index' ... "
error

Try to run the following commands on terminal:
npm install
cd ios; pod install; cd../
react-native link

try this:
Stop the MetroBundler/launchPackager
Delete node_modules
rm -rf node_modules
Change the version on your package.json
from
"react-native": "0.59.1",
to
"react-native": "0.58.6",
Then clean the watchman
watchman watch-del-all
Run npm install again:
npm install
And try to run your project, in my case:
react-native run-ios

My bad. I accidentally deleted the index.js ..

Related

yarn run ios error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65

this is very basic error and it is already ask in stackoverflow and i tried all solution but it is not working in my project.
pod install in ios folder.
when i run command yarn run android it is run successfully but when i run yarn run ios command it throws error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AwesomeProject1.xcworkspace. .
dependencies: "react": "16.13.1",
"react-native": "^0.63.4",
I have a similar problem, but it works when I run npx react-native run-ios instead of yarn.

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

React Native: error: bundling failed: index.js: "" is not a valid identifer name

I have a React Native app which was running perfectly earlier this morning. I've deleted package-lock.json after mistakenly doing an npm install instead of a yarn install. Then I've ran yarn install and now when I try to run my app I get this error at the packager:
error: bundling failed: index.js: "" is not a valid identifer name
BUNDLE [ios, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.
I've also closed packager and Vscode, removed node_modules and tried running yarn install again but I get the same error. I haven't changed a single line in my code and it was working before that.
What is going on?
It is already opened as an issue.
https://github.com/facebook/react-native/issues/27118
https://github.com/facebook/react-native/issues/27120#issuecomment-549832676
Simply you need to delete "node_modules" and again run the command:
npm i or yarn
Also, you can simply re-create the scratch project with
react-native init example
It will work as expected. They reverted the changes on #babel/run-time at 7.7.1 version.
Have fun 🎊🎉
Delete node_modules and packages-lock.json, erase trash, close Metro Bundle, delete the app from emulator/simulator and run npm install, this way worked for me.
I had the same issue and none of the solutions mentioned here or in the links worked for me. The issue was the react-native local and global versions were different.
node node_modules/react-native/local-cli/cli.js run-ios worked for me.
and while bundling, node node_modules/react-native/local-cli/cli.js bundle --entry-file...
In short replace react-native with node node_modules/react-native/local-cli/cli.js when trying to run or bundle

The development server returned response error code: 500 in basic application in react native

I am Android Developer, I am new to react native development. For this, I followed bellow React Native Document
https://facebook.github.io/react-native/docs/getting-started.html
I did the following steps
1, I have installed node
2, I Have already installed JDK
3, I have installed Android studio
4, set the ANDROID_HOME path in environment variables
And in command prompt, I did run the following commands
npm install -g react-native-cli
Then create a new application, for this
react-native init AwesomeProject
Then successfully created the application, then go to that folder and run the application.
cd AwesomeProject
react-native run-android
Then getting the following error
And this is the node js error
So please help me, Thanks In Advance.
Try to follow the workarounds here : https://github.com/facebook/react-native/issues/4968.
Kill the bundler process, delete your modules folder, run npm install, rm -rf $TMPDIR/metro-cache-*, also rebuild your android project.
If this doesn't work, you can as well try to create your app using create-react-app toolchain which should be working fine : https://github.com/facebook/create-react-app .
This is a bug within Windows environment for React Native 0.56 you may need to upgrade/downgrade your React Native version. I encountered it, made even worse when I tried to use Typescript.
What I would is run a new project using the latest version 0.57 and just build, if it doesn't build straight away - then use 0.55 until the issue is resolved.
Try this solution, it was worked for me.
Steps to create New React Native project:
react-native init projectName (ProjectName: eg.HelloWorld)
cd HelloWorld
npm start
Open another node command prompt and goto the project path and then run your project with below given command.
react-native run-android
I think you missed 3rd step i.e to start npm.
And if you are again getting same error, follow these steps:
rm -rf node_modules && npm install
rm -rf /tmp/metro-bundler-cache-*
rm -rf /tmp/haste-map-react-native-packager-*
react-native run-android

react native unable to run-android

I have followed guide here to setup react-native 0.23 https://facebook.github.io/react-native/docs/getting-started.html#content
I tried to run
react-native run-android
and got the following
Looks like you installed react-native globally, maybe you meant
react-native-cli? To fix the issue, run: npm uninstall -g react-native
npm install -g react-native-cli
and I tried above command to uninstall and install but still getting the samething.
I google and found some solution at Packager won't start
Tried:
"scripts": {
"start": "$NVM_BIN/react-native start"
}
and
react-native start
both still didn't work. For iOS no problem as I fired up XCode to run it. I have also installed VirtualBox and Genymotion as emulator.