React-Native app with cocoapods - xcode

I have a react-native application which comes with .xcodeproj file for ios.
I upgraded the project to use cocoapods which added .xcworkspace and updated .xcodeproj file.
Now anytime i try to upgrade react-native to latest version upgrading .xcodeproj is a nightmare.
Just curious if you are facing similar issues then what is the best practice you found to deal with upgrades?

Yes I had a lot of pain following the recommended ways. Finally, here's what I found to be a pain free way to do the upgrade:
$ rm package-lock.json (or npm-shrinkwrap.json, whichever you have)
Update package.json with the new version of React and React-Native dependencies
$ npm install
$ npm-shrinkwrap (if you had an npm-shrinkwrap.json)
$ rm Podfile.lock
$ pod install
Open workspace (*.xcworkspace) and build.
(This has worked fine when upgrading from 0.46.0 to 0.50.3 version for me)

Related

Expo client is not installing on Simulator

I have been using this setup for almost half a year now and I upgraded the Expo SDK to 44 (erased all content and settings on the simulator). Ever since, the expo client won't install on the simulator.
Things I have tried:
run expo client:install:ios
uninstall and reinstall expo
uninstall and reinstall watchman
tried different simulators (15.0 that I used so far)
creating a new blank expo project
open the simulator first and then npm start
I even did a complete MacBook reset (factory, needed to wipe anyway) and reinstalled following the expo documentation.
I read something about installing expo without sudo, but then it will throw errors and will simply not install.
New blank expo project infos:
Expo : 44.0.0
expo-cli: 5.0.3
react-native: 0.64.3
Hope someone knows the solution to this, I really want to get back programming.
I had the same problem. Turns out using sudo when installing expo-cli is the issue. Run the following commands to resolve it.
npm uninstall -g expo-cli
npm install -g expo-cli
Then from your Mac's user's directory in a new terminal, run the following:
mkdir apps
cd apps
expo init app-name
Once this finishes, it should work just fine after running npm start.
As #Mercify said, sudo was indeed the problem.
For future reference: if installing expo without sudo throws an error, it is nessecary to change "the owner" of the folder "/usr/.../node_modules" to your user.
This post helps changing the owner.
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
Expo is now installing on the Simulator.
Thanks to #Mercify.

Clone and setup Repository from Bit Bucket to XCode

joined a new organisation. Never worked on react native repositories before.
I need a quick help on how to clone a React Native repository from bit bucket to Xcode and setup to work only on iOS module.
I have downloaded the repository and open the iOS Folder and opened projectname.xcworkspace file. It opened my project but so many files are missing. So I assume that it is not the right way to do. Please help.
I think you didn't use command of npm install or yarn install then after completed the above command you need to use cd ios(Go to ios directory) and pod install then you should open your projectname.xcworkspace file.
if you have package-lock.json then use npm install and if you have yarn.lock then use yarn install command.

Running RNTester

I am getting into React Native. I want to try running RNTester to check out the components they have. I had no issue runnning my other react project.
I tried the commands:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
and also run the project with open RNTester/RNTester.xcodeproj
The errors I got:
error message
my Xcode version: 9.0(9C40b)
clang version: Apple LLVM version 9.0.0 (clang-900.0.39.2)
Instead of running with RNTester.xcodeproj
I got around with CocoaPods.
run pod install in the RNTester folder
run the .xcworkspace file generated from the command

Unable to build Xcode project on circleCi

I'm using cocoapods v1.0.1. My build is successful in Xcode 7.2.1 but when I push the changes to git it fails on circleci.com.
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
I have tried every possible ways using this link and similar links but no success at all.
Already tried this link: Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods
Try to add the following into your circle.yml file:
dependencies:
override:
- pod install
https://discuss.circleci.com/t/the-sandbox-is-not-in-sync-with-the-podfile-lock/5537

Phonegap installation error (npm)

I have been searching for a solution for two days now to setup Phonegap on my Windows 8.1
system without any success.
Whenever I try to install Phonegap through npm I get an error that I think has to do
with Cordova(-lib).
To install Phonegap I had to install Node.js (v0.10.28) on my system. After this I opened up Windows Powershell and issued the following command like instructed on the Phonegap website:
npm install -g phonegap
Output: (This is the only part of the error)
error notarget No compatible version found: cordova-lib#'lorinbeer/cordova-lib.git#configparser_module'
error notarget Valid install targets:
error notarget ["0.21.2","0.21.3"]
error notarget
error notarget This is most likely not a problem with npm itself.
error notarget In most cases you or one of your dependencies are requesting
error notarget a package version that doesn't exist.
I also tried installing just Cordova through the npm and then install Phonegap, but that
didn't solve anything either.
Running the Powershell with administrator rights also didn't help and tried solutions of other people who also had problems setting up Phonegap, but nothing works.
I really hope that someone could help me out here.
Thanks in advance.
Download the older version. I think there was a problem in the new one
npm install -g phonegap#3.4
I tried this and worked for me.
I had the same issue yesterday. If you check npm-debug.log, you'll notice that there is a permission issue ("Permission denied") when npm tries to access the cordova-lib git repository url. Actually, cordova-lib is a dependency for phonegap. So, it can't install it and I think that's why you get that error.
So, I tried this: install cordova-lib first then Phonegap. Yet, it still won't work; npm does not seem to check if cordova-lib is installed before trying to do it.
At this point, what I could do is to change the repository from which it retrieves cordova-lib. Here is the NPM install syntax:
npm install <tarball file>
npm install <tarball url>
npm install <folder>
npm install <pkg>
npm install <pkg>#<tag>
npm install <pkg>#<version>
npm install <pkg>#<version range>
This means I can install from a tar.gz file. Great! So, I just went to this page https://www.npmjs.org/package/phonegap to check the phonegap repository and performed these steps:
Download the zip of phonegap-cli repo (https://github.com/phonegap/phonegap-cli/archive/master.zip)
Unzip it
Open the package.json file and find the cordova-lib entry in dependencies (line 32)
Change the value to 0.21.3 which is the last version.
Recreate an archive of the folder to the tar.gz format
Open your CLI and run this command:
npm install -g path/to/archive/phonegap-cli-master.tar.gz
It should work now.
Hope that help!
I had a similar problem today too on Mac, even after Lorenzo said it should be all fine. Just running this:
sudo npm install -g phonegap
... produced loads of errors like this:
error: file ./objects/pack/pack-48c0ff4147fb7e8922546c4a857b98a1cb48e01f.pack is far too short to be a packfile
I combined Lorenzo and arpan shah's solutions:
sudo npm install -g phonegap#3.4
sudo npm cache clean
sudo npm update -g phone gap
... and it seemed to magically work.
Problem
We published with a dependency on a branch of cordova-lib. This fork appears unavailable when lots of requests are coming through (I think). One way or another, it's unreliable.
Changing the dependency to 0.21.3 will cause commands to fail, but will allow the install.
Solutions
update the 'cordova-lib' dependency to the npm published version '0.21.3'
**note, this will allow the install, but other phonegap commands will fail
wait for about 20 minutes, then npm update -g phonegap
testing an update to resolve this issue
further updates momentarily
update
We've pushed version 3.5.0-0.20.3 which should resolve this issue
$ npm update -g phonegap
if that doesn't work, try
$ npm cache clean
and reinstall phonegap
I tryed above comamnds npm cache clear and reinstall phoegap. It downloaded all libs but not command line scripts (phonegap command had still 3.4 as version). I found that better was to give command: npm install -g cordova (v 3.5)!

Resources