Big Sur, React Native and launchPackager.command - ios

Since upgrading to macOS Big Sur every time I run an React Native app with npx react-native run-ios it opens the package manager in TextEdit instead of a Terminal.
When running node_modules/react-native/scripts/launchPackager.command manually from Finder or the Terminal it works just fine. The file extensions is mapped to Terminal and I obviously have correct access rights on the file.
I've also removed node_modules and reinstalled them.

The latest beta of Big Sur seems to avoid this problem. Leaving the question here in case anyone else has the same problem with older betas.

Related

Building old version of React-Native app with Xcode 11

I just started working on an already existing React-Native app that needs a really small update, but that has not been updated since October 2019.
The first thing I need, in order to start updating it, is to build the app. That is where I cannot find a way to do it.
At the moment, I’m trying to build the app only on iOS and not on Android.
First of all the current toolset versions I’m using are:
React-Native version: 0.53.3
Xcode version: 11.4.1
iOS SDK: 13.4
Node version: 8.16.6
NPM version: 6.14.1
I initially had problem with third-party tools, but I managed to fix it through manually installing them in the node-modules/react-native folder.
Now I’m getting errors about Xcode not finding headers of the modules the app is using
like, for example,
React/RCTViewManager.h file not found
Or, similarly, the GoogleSignIn.h headers in the RNGoogleSignIn module
I believe it’s just an error of how libraries are imported in Xcode, because as a test I have created a new react-native “test app” with the same exact versions of react-native and node, then I installed the core dependencies needed to perform the update on the original app, and I managed to build it without problems.
I’ve also tested building the app on an old Mac with macOS 10.14, using Xcode 9, but I’ve got different errors, always related to importing headers of modules.
This is the toolkits versions of the “old Mac”:
React-Native version: 0.53.3
Xcode version: 9.4.1
iOS SDK: 11.3
Node version: 8.16.6
NPM version: 6.14.1
Searching online I know that some of the problems I have faced (like the third-party react-native manual install) have been fixed in react-native updates, but I’m not expert enough with the technology to be sure that I can handle the update process without introducing bugs. I would prefer to just make this version run for now and facing the updating process later.
Do you have any suggestion of things about what I can do in order to successfully build the app?

If anyone ever comes here with a similar problem: the solution was pretty simple.
Be sure you're using the .xcworkspace file in your iOS folder, and not the .xcodeproj. This is used to automatically (and correctly) load the Pods dependencies in Xcode without having to manually link them.
Be sure that you installed the dependencies correctly with the right version of Cocoapods. We had to use an old version (1.5.x) that would automatically downloaded some pod dependencies. Our error was due to Facebook SDK. Newer versions of cocoapods did not download it, while the 1.5.x version would download it.

How to fix expo start throwing "Simulator is installed but is identified as 'com.apple.CoreSimulator.SimulatorTrampoline'; dont know what that is"

I am trying to set up a react-native development environment. I would like to set up an iOS emulator (preferably an iPhone 10) to run my app on. I am using a Macbook Pro 2016 running on MacOS 10.14.3. I have installed my react-native app through the command create-react-native-app (running version 2.0.2). I also have installed XCode running version 10.2(10E125). When I scan the QR code that Expo generates and run it on my iPad or my Android device it works just fine, but when I try to load the iOS emulator by pressing i after expo start it returns the error
Trying to open the project in iOS simulator...
Simulator is installed but is identified as 'com.apple.CoreSimulator.SimulatorTrampoline'; don't know what that is.
Simulator not installed. Please visit https://developer.apple.com/xcode/download/ to download Xcode and the iOS simulator. If you already have the latest version of Xcode installed, you may have to run the command `sudo xcode-select -s /Applications/Xcode.app`
I have already tried running the command sudo xcode-select -s /Applications/Xcode.app
I have also tried running the command xcode-select -r
I have also confirmed that in my XCode->Preferences->Locations Command Line Tools is selected as "Xcode 10.2(10E125)"
None of these have worked.
I am expecting that after pressing i after expo start an iOS emulator loads up. Thank you.
-----EDIT-------
After some more research, I found out that running open -a Simulator and then running expo start loads the app on an emulator and works for my purposes. But still if I just run expo start without running open -a Simulator it still gives the same error. I want to ask if this is the best I am going to get?
You might be running an outdated version of Expo. I had this problem when I was download someone's old repo using Expo 27 when Expo 36 came out. After updating to the latest version, it works.
To update packages in your project, npm-check-updates comes in handy.
npm i -g npm-check-updates # installs ncu globally
ncu -u # updates all dependency versions in your local package.json
npm install # updates the packages in node_modules to match
Note: This will update all your dependencies to the latest version. If you don't want to do this, you can find the latest version of expo and change the version in package.json manually.
I ran into the exact same problem all of a sudden. Clicking "Run on iOS Simulator" within the Expo Developer Browser worked 2 days ago but did not work today. Your clue of using open -a Simulator helped me though. I went into Xcode and clicked the Xcode menu > Open Developer Tool > Simulator. This started the Simulator and then I was able to click "Run on iOS Simulator" within the Expo Developer Browser and it worked as expected. If you haven't had the fortune of "Run on iOS Simulator" working, I'm guessing you could just start a simulator, download Expo from the App Store and just use it from there. None of this answers the question as to why the error happens but at least gives a few workarounds for anyone else that might need. All that matters is you get the app running on the Simulator in the end!

React Native app not running in XCode iOS simulator

I try to make my first steps using React Native. Development for Android (on Windows host) works. Now I wanted to test iOS, and tried to set up a development environment on a MacBook Pro.
Problem: React Native starts the iOS simulator, and then nothing happens any more. The simulator runs OK, but my React native app won't start.
What do I need to do to get my React Native installation going?
More Info:
I set up XCode and React Native according to the docs on the MacBook Pro running OSx 10.13.2 (High Sierra). XCode was installed and tested successfully, including the simulator.
When I installed Node.js I deliberately picked an older version (containing npm 4.2.0), since forums say that React Native does still have problems with npm 5. I also installed Homebrew and Watchman, like stated in the docs.
To initialize an empty project, I used
create-react-native-app HelloWorldProject
and a projet structure got created in my Documents folder.
If I finally fire up my "Hello World" test app using
cd HelloWorldProject
sudo react-native run-ios
the system responds:
Starting packager ...
Starting simulator ...
and then nothing happens. The simulator does indeed start (boot --> apple logo --> progress bar --> IOs start screen), but nothing happens afterwards.
Edit
I have given up on React Native for several reasons, I leave this question here for documentary purposes, but I cannot verify or accept any answer, I don't have a React Native development environment any more.
It's probably because you used sudo. /.expo/ is owned by root. Try to change the ownership with
sudo chown -R `whoami` ~/.expo
Refer https://github.com/react-community/create-react-native-app/issues/422
Even everything in your app seems fine, sometime you face the issue that the app is taking too much time to load either through terminal or Xcode. If there is no any other specific issue with your project, the following solution works most of the time:
Go to your app folder and then go to 'iOS' folder.
Delete 'Podfile.lock' and 'Pods' folder.
Execute the following command in Terminal from your 'ios' folder, that will bring back the 'Podfile.lock' and required Pods will be installed to 'Pods' folder:
pod install
Delete the 'build' folder in your 'iOS' folder.
Run the following command in terminal:
react-native run-ios
While the terminal is running, open '.xcworkspace' in your 'ios' folder in Xcode.
The above steps will make sure it will be build your react native project newly and will run on the simulator.
Thanks
Wasantha Wijayaratna

React Native : Sample App crashes after upgrading to Mac 10.12.6

I recently updated my Mac to OS.12.6 Sierra.
Previously working React Native (nothing fancy just their AwesomeProject sample app) stopped working.
When I run react-native run-ios I am able to launch the simulator the app just appears, and then crashes back to the iphone app screen without any error messages.
I have uninstalled and reinstalled react-native-cli, upgraded brew, watchman and reinstalled node modules..but no luck
Anyone has any pointers on this ?
I was having the same issues too after upgrading to Sierra 10.12.6.
I resolved by running create-react-native-app <folder>
And then I ejected it with yarn run eject
yarn run ios after, and the app seems stable.
I found out the rootcause of the issue.
Looks like this is a bug with the latest version.
Facebook has acknowledged this as a bug.
The workaround is to create the project with an older version like 0.44
https://github.com/facebook/react-native/issues/15770

Apache Cordova, Visual Studio 2015, Xcode 8.3 cannot remotebuild

It has been a year since I first build the app, and of course my iPhone software has updated since then. With that I was informed that I needed to update Xcode in order to get the right platform to get a release version for my cordova app updates. Updating xcode required me to update the OS to Sierra on the mac. After that, I have been unable to remotebuild even my debug version, which I had been able to do before.
My constant issue right now is that when I build the app in remote build it keeps adding "ios": "4.0.1" to the platforms.json file, but the error I receive is that with xcode 8.3 I need 4.3.0 or greater.
I cannot figure out how to update this value. I have upgraded npm, node, everything that I can think of. Nothing changes the value, and I can't seem to find anyone else with my problem.
Any help or suggestions would be welcome.
First, open up project platforms folder and delete ios folder. Then update cordova on your development machine and Mac.
For Mac : $ sudo npm install -g cordova
For Windows: npm install -g cordova
Just check whether your files getting deployed to the Mac build folder path. If so, open up the project using XCode.
Then build your project using XCODE. Most probably there will be an error to choose the development team. Once you select the account or the team fom dropdown list you can deploy the app without any issues.
That worked for me. Hope this will help you too.
Another way: Navigate to platforms folder -> platforms.json. Check the IOS version. Change it to 4.3.0 and delete the ios folder and add IOS 4.3.0 via command prompt.
packages.json
{
"android": "5.1.1",
"ios": "4.3.0"
}
in cmd Run
cordova platform add ios#4.3.0
Well, be ready for many actions to be done but in the end it works. )
Update your XCode to 8.3.3 without worry.
Then be sure to update your remotebuild to the latest version that is currently 2.1.3 by running sudo npm i remotebuild -g on your Mac.
Get back to your development machine with Visual Studio and run some command line utility in administrator mode. Open you cordova folder from there.
Execute cordova platform rm ios to remove the current ios version under cordova. It's also advised to remove the android one by cordova platform rm android.
Update the version of CLI you use for builidng on Visual Studio. Currently it's 7.0.1. There were people that claimed that 6.5.0 also works but in my setup 7.0.1 works as well.
Get back to your command line and run cordova platform add ios#4.4.0, This is the minimal cordova ios that supports the cordova 7.0.1.
In case you removed android as well then run cordova platform add android#6.0.0. There are more progressive versions of cordova android but I found them not working.
Now get back to your Mac and remove the following folder ~/.taco-remote/node_modules.
In case you don't see this .taco-remote folder it's the hidden one so run in command line of your Mac com.apple.Finder AppleShowAllFiles true and then killall Finder to close all instances of Finder. Afterwards .taco-remote folder should be visible under your user folder ~/.
Now go back to Visual Studio and open Tools > Options > Tools for Apache Cordova and run Clear Cordova cache.
Now run your ios and it should succeed.
In case you run afterwards your android build and it fails on something like Android platform already added run the Clear cordova cache again and then your android build also should succeed.
From this point both ios and android builds should work.
Whooof. )
Good luck!
BTW, most of this solution came from this thread.

Resources