pod install mkdir Permission denied - ios

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.

Related

Cocoapods error while running ios app which leads error in pod install

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

React native Pod install getting Permission denied

I'm created new project using command react-native init testprog
then change dir to testprog and pod install but it give permission denied error
$ pod install
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/MACMINI DATA SSD/testprog/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec && touch /Volumes/MACMINI DATA SSD/testprog/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h /Volumes/MACMINI DATA SSD/testprog/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm
mkdir: /Volumes/MACMINI: Permission denied
I was try following things but it not working
update pod
reinstall pod
chown command for ~/.cocoapods
chown command for ~/Library/Caches/CocoaPods
chown command for /usr/local/bin/npm
chown command for /usr/local/bin/npx
chown command for /usr/local/bin/node
What is wrong?
How to resolve it?
Pod version: 1.10.1
Os Version: 10.15.7
react-native Version: 0.64.0
There can be multiple reason for this.
There is one solution which always worked for me is
sudo pod install --allow-root
Go to your ios folder -> Go to get info -> read & write (to your user) -> click on small setting button below there -> Apply to enclosed items.

Error when starting project from command line

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.

why is cocoapods dependency installed failed when creating a react native app?

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

error running pod install error launching application on iphone11 Pro Max

I finished my flutter app, and i want to test it in ios device, so i used a mac laptop and i did all the installations but when i did the command "flutter run" i got this error
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install... 4,0s
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
A flutter_barcode_scanner
A geolocator
A google_api_availability
A google_maps_flutter
A location
A location_permissions
A shared_preferences
A shared_preferences_macos
A shared_preferences_web
- Flutter
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `flutter_barcode_scanner` from `.symlinks/plugins/flutter_barcode_scanner/ios`
-> Fetching podspec for `geolocator` from `.symlinks/plugins/geolocator/ios`
-> Fetching podspec for `google_api_availability` from `.symlinks/plugins/google_api_availability/ios`
-> Fetching podspec for `google_maps_flutter` from `.symlinks/plugins/google_maps_flutter/ios`
-> Fetching podspec for `location` from `.symlinks/plugins/location/ios`
-> Fetching podspec for `location_permissions` from `.symlinks/plugins/location_permissions/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `shared_preferences_macos` from `.symlinks/plugins/shared_preferences_macos/ios`
-> Fetching podspec for `shared_preferences_web` from `.symlinks/plugins/shared_preferences_web/ios`
Resolving dependencies of `Podfile`
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "flutter_barcode_scanner":
In Podfile:
flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)
Specs satisfying the `flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)` dependency were found, but they required a higher minimum deployment target.
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:986:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:984:in `resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:234:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
Error running pod install
Error launching application on iPhone 11 Pro Max.
try this
rm ios/Podfile
flutter pub upgrade
flutter pub run
cd ios
pod init
pod update
flutter clean && flutter run
Flutter: Try this
Delete the Podfile, Podfile.lock, Pods folder, Runner.xcworkspace, Flutter.framwork(in ios/Flutter folder)
flutter clean
flutter build ios
For the m1 Mac I had a similar error for google mobile ads. The solution was that you have to download cocoa-pods from homebrew.
Follow The 2022 update: https://stackoverflow.com/a/65334677/16122154
The following works for me:
sudo arch -x86_64 gem install ffi
Trust me, I search for over 5 hours, tried every solution I cound find on internet. And only one work:
Delete the Podfile, Podfile.lock, Pods folder
flutter clean
cd ios
pod deintegrate ( this way pod will not reinstall the old libray )
cd ../
flutter run
Most of the solution don't include step 4, so that why even you clean and reinstall pod, it still behave the same.
If you are using Flutter, in your pubspec.yaml file make sure that your dependencies are installed below the cupertino icons line with correct indentation or it'll throw an error.
https://gorails.com/setup/osx/10.15-catalina
Make your day happy thanks buddy for the help...
MacOS catalina has permission issues on pre installed ruby and rails.
rbenv is best version control thing.
You need to install this tool by using terminal:
Open your terminal and type these commands:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
And then run these commands:
brew install rbenv ruby-build
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
source ~/.zshrc
# Install Ruby
rbenv install 2.7.1
rbenv global 2.7.1
ruby -v
now install pods by going to your ios folder in flutter project
cd ios
pod install
That's it.

Resources