React Native Cocoapods installation Issues - react-native

Anyone #with help on how to setup #reactnative #ide on #M1Macbookpro? Tried a number of YouTube tutorials but my problem begins when I start running "npx react-native init " and have problems installing cocoapods, even when I cd > install #dev #vscode
Followed the react native official installation guide all to no avail. Tried running terminal in rosetta to install cocoapods but still no results. Any help?
This is the error:
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./AwesomeProject07/ios && pod install".
CocoaPods documentation: https://cocoapods.org/

try to run pod install with this command
sudo arch -x86_64 pod install
also run this command too
sudo arch -x86_64 gem install ffi

Related

couldn't initiate a new react-native app because iOS environment is not properly set

first time Mac user trying to start a new react-native application. After doing this:
npx react-native init project_adji --template react-native-template-typescript
it fails with the following message:
✔ Downloading template
✔ Copying template
✔ Processing template
✔ Installing Bundler
✖ Installing CocoaPods dependencies (this may take a few minutes)
error warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
I updated the ruby via rbenv to the required version to reach this point (ruby 2.7.5). I couldn't find the exact issue with my setup.
Any tips?
I had exact the same issue here. After some research, I solved by following these steps:
gem uninstall cocoapods
sudo xcodebuild -license accept
Then created a test project to see where if everything works fine by following:
npx react-native init tempProject --skip-install
cd tempProject
yarn install
cd ios
bundle install
bundle exec pod install

I suddenly can't initialize a react-native app, although it has worked before

I ran "npx react-native init Test"
Downloading template
✔ Copying template
✔ Processing template
ℹ Installing dependencies
✔ CocoaPods (https://cocoapods.org/) is not installed. CocoaPods is necessary for the iOS project to run correctly. Do you want to install it? › Yes, with Homebrew
✔ Installing CocoaPods
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
but CocoaPods is installed:
pod --version returns 1.11.3
react-native version is 8.0.6
If you are using M1 or up processor, try updating ruby and again install cocoapods or you can go into iOS folder and do pod install
I possible please share whole error from terminal.
Thanks :)

Cocoapods error when Initializing react-native app on Mac mini (Apple M1, 2020) running Monterey

I'm on a Mac mini with Monterey OS trying to init a react-native app.
npx react-native init AwesomeProject
gives me:
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./AwesomeProject/ios && pod install".
CocoaPods documentation: https://cocoapods.org/
when I try
cd ./AwesomeProject/ios && pod install
I get:
664 /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/ffi.rb
665 /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: https://www.ruby-lang.org/bugreport.html
[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.
zsh: abort pod install
Is anyone else encountering the same problem?
EDIT:
Uninstalled and re-installed Ruby and Cocoapods.
This was a helpful post
and used:
arch -x86_64 pod install
Using that processor does bring some issues with installing pods. Please try arch -x86_64 pod install and see what it brings.
Link to some older post:
React Native ios builds failing suddenly

Properly set-up react-native on Mac with M1 (can't find the right answer)

I have a MacBook Pro M1 and I am trying to start a React Native project with PyCharm/WebStorm but running in the following issue:
info Installing required CocoaPods dependencies
✔ CocoaPods (https://cocoapods.org/) is not installed. CocoaPods is necessary for the iOS project to run correctly. Do you want to install it? › Yes, with gem (may require sudo)
error
/Users/nicolamacchitella/PycharmProjects/reactproject/node_modules/metro-hermes-compiler/src/emhermesc.js:77
throw ex;
^
RuntimeError: abort(Error: An error occured while trying to install CocoaPods, which is required by this template.
Please try again manually: sudo gem install cocoapods.
CocoaPods documentation: https://cocoapods.org/). Build with -s ASSERTIONS=1 for more info.
at process.abort (/Users/nicolamacchitella/PycharmProjects/reactproject/node_modules/metro-hermes-compiler/src/emhermesc.js:440:13)
at process.emit (node:events:390:28)
at emit (node:internal/process/promises:136:22)
at processPromiseRejections (node:internal/process/promises:242:25)
at processTicksAndRejections (node:internal/process/task_queues:97:32)
Node.js v17.0.1
Done
I also running some issues at first while to setup the development environment on my M1 Macbook Pro.
Try to run:
sudo gem install cocoapods
If it doesn't work, install Homebrew, and run:
brew install cocoapods

How to run pod file in iOS directory in react native?

error Could not find "Podfile.lock" at projects\reactNative\ios\Podfile.lock. Did you run "pod install" in iOS directory?
(node:11696) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
error Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues. Run CLI with --verbose flag
Issue 1
For fixing the issue:
Could not find "Podfile.lock" at projects\reactNative\ios\Podfile.lock. Did you run "pod install" in iOS directory?
Please make sure you have install cocoapods and run this command at your project root:
gem install cocoapods // If you haven't install cocoapods
cd ios && pod install && cd ..
Issue 2
For fixing the issue:
(node:11696) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use node --trace-warnings ... to show where the warning was created)
Please downgrade your node.js version to v13.x.x, one of the solutions below:
npm install -g n
sudo n 13.13.0
Issue 3
For fixing the issue:
Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues. Run CLI with --verbose flag
Please make sure you have installed Xcode correctly from App Store and use the latest React Native version in your project (should be v0.62.2 now for stable). If still cannot open the project, please try to add some simulator in Xcode's developer settings.
Cheers!
you did not install cocoapods
install cocoapods commands
sudo gem install cocoapods
after that in react native directory
cd ios && pod install && cd ../ && react-native run-ios
CocoaPods manages library dependencies for your Xcode projects. We need it to setup the iOS project. Like yarn
sudo gem install cocoapods
The Podfile is a specification that describes the dependencies of the targets of one or more Xcode projects. Like package.json
access to the folder with Podfile, run
pod install
This will resolve the code of those dependency framework, and generate Pods.xcodeproj for your iOS project.