Nameer
Nameer

Reputation: 149

pod install mkdir Permission denied

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..

Upvotes: 2

Views: 2106

Answers (3)

A J A Y
A J A Y

Reputation: 654

This so happens because Cocoapods is not able to create / modify files in your project. The suggested option above - sudo pod install will never work, as Cocoapods is not allowed to be run as root.

The best solution would be to enable Read and Write access for the folder inside which you are trying to run the command. Go to finder, right click on the folder and enable the access, then it should run fine.

Upvotes: 0

Aurimas Steponaitis
Aurimas Steponaitis

Reputation: 56

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.

Upvotes: 2

Nisha Mistry
Nisha Mistry

Reputation: 141

Have you tried Running your pod install command using sudo. Or Update your project directory permissions using chmod command.

Upvotes: 0

Related Questions