ReactNative fails to deploy build to iOS simulator but does deploy it to Android emulator - react-native

ReactNative fails to deploy build to iOS simulator but does deploy it to Android emulator
Attached are screenshots showing this on both.
Steps:
Created react native app
react-native init proto
Run app on Android emulator after I started emulator
react-native run-android
this is running fine on Android emulator
Run app on iOS simmulator
react-native run-ios
This produces error as per screenshot
Error
** BUILD FAILED **
The following build commands failed:
CompileC /Users/dinob/reactnativework/proto/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTShadowView+Internal.o Views/RCTShadowView+Internal.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/proto.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/proto.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Versions
MacBookPro OSX El Capitain
react-native 0.55.3
react-native-cli 2.0.1
npm 5.5.1
node v8.9.1
watchman 4.9.0

Please have a look here for help with troubleshooting
I would suggest you try all the solutions described in that thread to try and fix this issue. Good Luck!

Related

Getting Building iOS bundle error when trying to build an android app - expo -react-native

I was able to build app using expo build:android previously. However, after upgrading to latest expo version I get following error:
connect ECONNREFUSED 127.0.0.1:19001
Set EXPO_DEBUG=true in your env to view the stack trace.
I also see the following lines in the log:
Publishing to channel 'default'...
Building iOS bundle
I don't added ios to my app.json, I only need to build an android apk. To do that I use expo build:android -t app-bundle
I also removed package-lock.json and node_modules and run npm install, but I get the same error.
I run expo start on another cmd and then run expo build:android -t app-bundle still get same error
Also when I clear expo cache, see the following log:
Restarting Metro Bundler...
Starting Metro Bundler on port 19001.
Couldn't adb reverse: adb.exe: error: Invalid source port: 'undefined'
I had faced same issue myself and found the solution. Expo is looking for localhost:19001 which is not running. Just follow following steps and it should work as expected:
Run expo start no terminal and once it opens up the
browser where you will find this line written Starting Metro
Bundler on port 19001.
Now open another terminal instance and run expo build:android.

"could not connect to development server" error running React Native tutorial with Expo, suspecting Watchman

New to react native and mobile dev, running into this problem:
I am running the React Native hello world from the Facebook Website using Expo CLI as the build tool. What I did was to install Expo, run expo init test, install cocoapods, and cd into the test directory and run expo start.
When I open the app on iOS simulator or my iPhone, I get "Could not connect to development server" after about 3-5 minutes in white screen (see screenshot).
In the Expo logs. It is notable that upon every startup I get the following error logs:
2019-08-25T21:49:21,474: [cli] Failed to open /Users/nsadeh/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Not a directory
ERROR
21:49
Watchman: watchman --no-pretty get-sockname returned with exit code=null, signal=SIGABRT, stderr= 2019-08-25T21:49:21,474: [cli] Failed to open /Users/nsadeh/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Not a directory
I have already tried un- and reinstalling Watchman as well as Expo. Not sure what else to do.
To reproduce:
macOS Mojave 10.14.6
node v10.16.3
expo 3.0.10
Watchman 4.9.0
react-native 0.59.10
Run expo init and from the top directory expo start.
Solution: turns out that postgreSQL left an unrelated LaunchAgents.plist file in my Library that was confusing Watchman. Renaming it resolved the issue.

Cannot running successful built react-native project on iOS simulator error

I'm programming an APP using react-native, but after I pulled from github this morning, it turned out that I couldn't run it anymore. The logs in the command line are as follows:
** BUILD SUCCEEDED **
The following commands produced analyzer issues:
Analyze Base/RCTModuleMethod.mm normal x86_64
(1 command with analyzer issues)
Logs in "react-native start" command line are as follows:
error: bundling failed: TypeError: Cannot read property 'bindings' of null
at Scope.moveBindingTo (/Users/martin/Desktop/ble-server/node_modules/#babel/traverse/lib/scope/index.js:978:13)
at BlockScoping.updateScopeInfo (/Users/martin/Desktop/ble-server/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17)
at BlockScoping.run (/Users/martin/Desktop/ble-server/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12)
at PluginPass.BlockStatementSwitchStatementProgram (/Users/martin/Desktop/ble-server/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24)
at newFn (/Users/martin/Desktop/ble-server/node_modules/#babel/traverse/lib/visitors.js:237:21)
at NodePath._call (/Users/martin/Desktop/ble-server/node_modules/#babel/traverse/lib/path/context.js:65:20)
at NodePath.call (/Users/martin/Desktop/ble-server/node_modules/#babel/traverse/lib/path/context.js:40:17)
at NodePath.visit (/Users/martin/Desktop/ble-server/node_modules/#babel/traverse/lib/path/context.js:100:12)
at TraversalContext.visitQueue (/Users/martin/Desktop/ble-server/node_modules/#babel/traverse/lib/context.js:142:16)
BUNDLE [ios, dev] ../../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.
How could I run it again, it seems that there are no issues with codes.
Please run command first:
npm start
and then
react-native run-ios
You have probably updated react-native improperly please check the documentation.
You may have used npm audit fix which updates react-native.
To fix the problem you can downgrade the react-native version of the app with
npm install react-native#x.x.x"
Then re-compile project with
react-native run-ios"
And don't forget to restart the bundler as well with
react-native start
Then, if you still want to upgrade the react-native version you can use
react-native-git-upgrade

Error launching React Native app from command line

I have a React Native app and recently upgraded to React Native 0.55. I previously could run the command react-native run-ios --simulator="iPhone X" to launch the app in the Simulator. Now I cannot, but I can still run the app in Xcode using build and run.
Here is the error from the react-native run-ios --simulator="iPhone X" output:
▸ Compiling RCTBundleURLProvider.m
❌ /dev/node_modules/react-native/React/Base/RCTBundleURLProvider.m:15:53: use of undeclared identifier 'undefined'; did you mean 'underline'?
const NSUInteger kRCTBundleURLProviderDefaultPort = RCT_METRO_PORT;
^~~~~~~~~~~~~~
▸ Compiling RCTLayoutAnimationGroup.m
▸ Compiling RCTNavigator.m
▸ Compiling RCTTabBar.m
** BUILD FAILED **
The following build commands failed:
CompileC /dev/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTBundleURLProvider.o Base/RCTBundleURLProvider.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing Build/Products/Debug-iphonesimulator/MyApp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier Build/Products/Debug-iphonesimulator/MyApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
In case it helps, here's the output of react-native info:
Environment:
OS: macOS High Sierra 10.13.3
Node: 9.5.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.3
react-native: 0.55.0 => 0.55.0
What's wrong with my setup and how should I fix it?
As a workaround you should try
react-native run-ios --port 8088 or RCT_METRO_PORT=8081 react-native run-ios but unsure if that works.
RCT_METRO_PORT var was added in commit 33d710e8c58ef1dc69816a59ac1cf390894e7cb9 and looks like it breaks versions 0.54/0.55 to run ios apps from the cli.
In the meantime I continue using xcode to run my react-native apps.
Hopefully it can be patched or cherry picked or ultimately be fixed on the next major release.
There is an open GitHub issue about it.

Error running Expo app on iOS Simulator

When attempting to launch an Expo project from the XDE, I am presented with the following issue where the Expo simulator app will not install:
Error running xcrun simctl install booted
/Users/username/.expo/ios-simulator-app-cache/Exponent-X.Y.Z.app: An
error was encountered processing the command
(domain=NSPOSIXErrorDomain, code=22): Failed to install the requested
application The bundle identifier of the application could not be
determined.
Ensure that the application's Info.plist contains a value
for CFBundleIdentifier.
Error installing or running app. Error: Process exited with non-zero
code: 22
Which will display like the following image in the XDE:
This appears to be a corrupted or incompatible version of the simulator app that is stored on your computer. The Expo Development Environment (XDE) does not resolve this issue automatically.
As mentioned on the Expo and XDE forums, the way to resolve this issue is to navigate to:
~/.expo/ios-simulator-app-cache/
In the Finder, and delete the file Exponent-X.Y.Z where X, Y, and Z represent the version of the app.
Source: https://forums.expo.io/t/error-installing-expo-on-ios-simulator/741