I am a fresh man for using react native. And I am following the get started of react native on my Mac. When I use npx react-native init AwesomeProject to create a new app, then I get a result shows me:
✔ Downloading template
✔ Copying template
✔ Processing template
⠋ Installing CocoaPods dependencies (this may take a few minutes)
[!] Invalid `Podfile` file: [!] /usr/local/bin/node -e console.log(require('#react-native-community/cli').bin);
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module '#react-native-community/cli'
Require stack:
- /Users/rionay/Desktop/react-native/AwesomeProject/ios/[eval]
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at [eval]:1:13
at Script.runInThisContext (vm.js:116:20)
at Object.runInThisContext (vm.js:306:38)
at Object.<anonymous> ([eval]-wrapper:9:26)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at evalScript (internal/process/execution.js:80:25) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Users/rionay/Desktop/react-native/AwesomeProject/ios/[eval]' ]
}
.
# from /Users/rionay/Desktop/react-native/AwesomeProject/ios/Podfile:42
# -------------------------------------------
#
> use_native_modules!
# end
# -------------------------------------------
✖ 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/
But I have installed CocoaPods by sudo gem install cocoapods, and it shows me:
Successfully installed cocoapods-1.8.4
Parsing documentation for cocoapods-1.8.4
Done installing documentation for cocoapods after 3 seconds
1 gem installed
So What's the problem? How can I fix it? Thank you very much!
It's a bug, had the same problem this morning. I fixed it by doing
npm i #react-native-community-cli
After that i went in the ios folder and could do pod install succesfully
Related
I am trying to create both ios and android app and It works fine for android but for ios while running flutter run it will take lot of time installing pod using pod install and at last it will give an error as shown below.
Error output from CocoaPods:
↳
Cloning into
'/var/folders/f6/g4njsx3x5tx5dswcbsh29tdh0000gn/T/d20210605-16785-1rc0t
ko'...
fatal: unable to access 'https://github.com/grpc/grpc.git/': Failed to
connect to github.com port 443: Connection refused
Error running pod install
Error launching application on iPhone 12 Pro Max.
I tried these posts but no luck
error running pod install
error running pod install pods-runner
pubsec.yaml
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
image_picker: ^0.6.7+17
firebase_ml_vision: ^0.9.10
image_cropper: ^1.4.0
firebase_core: ^0.3.4
cloud_firestore: ^0.9.13+1
expandable: ^5.0.1
web_scraper:
If any extra information needed, Let me know in comments
After many research I found a solution,
Step 1: I removed all cocoapods and it's directory using
gem list --local | grep cocoapods
sudo gem uninstall EACH_OF_THEM // here EACH_OF_THEM means all the listed cocoapods
rm -rf ~/.cocoapods
Step 2: Installed HomeBrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 3: Install cocoapods using HomeBrew
brew install cocoapods
Step 4: remove Podfile.lock if present
cd ios
rm Podfile.lock
Step 5: Now install pod
pod install --repo-update
It will take lot of time to download and install all the dependencies.
Now, If I run flutter project using flutter run. It succeed
...
Running pod install...
Running Xcode build...
...
refered link : dev.to
I have a new React Native project with RN 64.0, when I run npx pod install it fail returning this:
npx: installed 1 in 27.036s
Scanning for pods...
1.10.1
> pod install
Auto-linking React Native modules for target `MyMALnew`: RNCAsyncStorage, RNCMaskedView, RNGestureHandler, RNReanimated, RNScreens, and react-native-safe-area-context
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Downloading dependencies
Installing CocoaAsyncSocket (7.6.5)
Installing DoubleConversion (1.1.6)
Installing FBLazyVector (0.64.0)
Installing FBReactNativeSpec (0.64.0)
[!] /bin/bash -c
set -e
mkdir -p /Volumes/Macintosh HD - Data/WORK/MyMALnew/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec && touch /Volumes/Macintosh HD - Data/WORK/MyMALnew/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h /Volumes/Macintosh HD - Data/WORK/MyMALnew/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm
mkdir: /Volumes/Macintosh: Permission denied
ps: this is the first time I use npx prefix with RN, not sure if this is the issue here :)
Thanx for helping..
It's because your Volume name "Macintosh HD" consists of two words separated by space.
This generated path -> mkdir -p /Volumes/Macintosh HD should be replaced with mkdir -p "/Volumes/Macintosh HD" (added quotation marks) by RN team I think.
I had the same issue and renaming of my Volume to single word and reinstalling node_modules solved the issue.
Have you tried Running your pod install command using sudo.
Or Update your project directory permissions using chmod command.
I installed the package using npm I then followed these instructions (french) to configure it for iOS. But I can't run the app using npx react-native run-ios, it gives me this error:
xcodebuild: error: Could not resolve package dependencies:
because no versions of facebook-ios-sdk match the
requirement 7.0.2..<8.0.0 and root depends on
facebook-ios-sdk 7.0.2..<8.0.0, version solving failed.
I tried to reinstall react-native-fbsdk and also installing pods again:
$ cd ios
$ rm Podfile.lock
$ pod repo update
$ pod install
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Auto-linking React Native modules for target `XXX`: RNCMaskedView, RNFBApp, RNFBAuth, RNGestureHandler, RNGoogleSignin, RNReanimated, RNScreens, RNVectorIcons, react-native-fbsdk, react-native-get-random-values, react-native-safe-area-context, and react-native-webview
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Downloading dependencies
Installing FBSDKCoreKit 7.1.1 (was 7.0.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FBSDKLoginKit 7.1.1 (was 7.0.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Installing FBSDKShareKit 7.1.1 (was 7.0.1 and source changed to `https://cdn.cocoapods.org/` from `trunk`)
Generating Pods project
Integrating client project
Pod installation complete! There are 41 dependencies from the Podfile and 59 total pods installed.
On the other hand I have no issue running it from xcode (even though the error still show up).
My npm environment is the following:
{
"react-native": "0.62.2",
"react-native-fbsdk": "^2.0.0",
}
I still have no idea what's going on with the installation as proposed in the documentation. But we solved the problem in Xcode by updating facebook-ios-sdk:
file > Swift packages > Update to latest package versions.
After running this, facebook-ios-sdk version appears in Xcode (for us it was 7.1.1). And then the error goes away.
I tried to create a project through npx, but an error occurred.
$ npx react-native init springtesting
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./springtesting/ios && pod install".
So I executed a sentence inside the ios folder in the project.
$ pod install
[!] Invalid `Podfile` file: [!] /usr/local/bin/node -e console.log(require('#react-native-community/cli').bin);
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module '#react-native-community/cli'
Require stack:
- /Users/myname/springtesting/ios/[eval]
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (internal/modules/cjs/helpers.js:72:18)
at [eval]:1:13
at Script.runInThisContext (vm.js:120:20)
at Object.runInThisContext (vm.js:311:38)
at Object.<anonymous> ([eval]-wrapper:10:26)
at Module._compile (internal/modules/cjs/loader.js:1151:30)
at evalScript (internal/process/execution.js:94:25) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/User/myname/springtesting/ios/[eval]' ]
}
.
# from /Users/taehong/springtesting/ios/Podfile:42
# -------------------------------------------
#
> use_native_modules!
# end
# -------------------------------------------
Pod version
$ pod --version
1.8.4
What's the problem?
And then i deleted the phrase 'use_native_modules' and it became normal.
Your error clearly states #react-native-community/cli is missing install it globally using
npm i -g #react-native-community/cli
If still it throws the same error update the cocoapods using
brew upgrade cocoapods
run this:
xcode-select -p
if you do not get this path : Xcode.app/Contents/Developer
then run this command
sudo xcode-select --switch /Applications/Xcode.app
create again new project
Good to go..
Your question shows that you didn't install
#react-native-community/cli
Solution 1 : run this command
npm i #react-native-community/cli
update the cocoapods
Solution 2:
npm start -- --reset-cache
Whenever I try to install any of Google's cocoapods I get one of two errors.
Either:
$ pod install
Analyzing dependencies
[!] The version of CocoaPods used to generate the lockfile (0.38.0.beta.2) is higher than the version of the current executable (0.37.2). Incompatibility issues may arise.
CocoaPods 0.38.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Downloading dependencies
Installing Google (1.0.7)
[!] Error installing Google
...
inflating: /var/folders/<myDirectory>/Samples/signin/SignInExampleSwift/ViewController.swift
warning [/var/folders/<myDirectory>/file.zip]: 375 extra bytes at beginning or within zipfile
(attempting to process anyway)
Or:
$ pod install
[in /Users/<user>/Desktop/FakeProject]
Analyzing dependencies
CocoaPods 0.38.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Downloading dependencies
Installing AppInvites (1.0.1)
[!] Error installing AppInvites
[!] /usr/bin/tar xfz /var/folders/<myDirectory>/file.tgz -C /var/folders/<myDirectory>
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
I've been trying this with both new and existing objective-c projects and have tried uninstalling and re-installing cocoapods. Not really sure what the issue seems to be and Google doesn't have any troubleshooting for their cocoapods.
Try updating your gem
sudo gem update -n /usr/local/bin cocoapods
pod install
Deleting podfile.lock and pod install fixed it for me.
I had the same issue and I did gem install cocoapods first then pod install worked fine.
After 6 hours i found this
go to http://cocoapods.org/ and download tar file