Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - pod install issue "cannot load such file.......node_modules/react-native/scripts/react_native_pods"

when I have a react native project....and when I run pod install it gives me the following error

Invalid `Podfile` file: cannot load such file -- /myPath/node_modules/react-native/scripts/react_native_pods 

Here is my podfile

require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'  platform :ios, '10.0'  target 'xs' do   config = use_native_modules!    use_react_native!(:path => config["reactNativePath"])    target 'xsTests' do     inherit! :complete     # Pods for testing   end    # Enables Flipper.   #   # Note that if you have use_frameworks! enabled, Flipper will not work and   # you should disable these next few lines.   use_flipper!   post_install do |installer|     flipper_post_install(installer)   end end  target 'xs-tvOS' do   # Pods for xs-tvOS    target 'xs-tvOSTests' do     inherit! :search_paths     # Pods for testing   end end 

Ive checked and there is no file called react_native_pods in location myPath/node_modules/react-native/scripts/. Im wondering if its something to do with npm install is not generating correct files.....however I upgraded node to most recent version and then ran npm install

like image 992
james murphy Avatar asked Aug 15 '20 04:08

james murphy


People also ask

How do you install pods?

To install the pods, do one of the following: Place the caret at the code line where you add the pod, press ⌥ ⏎ , select Install, and press ⏎ . Click Install pods in the top-left corner of the editor window. From the main menu, select Tools | CocoaPods | Install.


2 Answers

I ran npm audit fix and it added react_native_pods file and pod install then worked

like image 76
james murphy Avatar answered Oct 06 '22 07:10

james murphy


Run npm audit fix ==> cd ios ==> pod install

like image 36
17bcs4133 Vishesh Gupta Avatar answered Oct 06 '22 07:10

17bcs4133 Vishesh Gupta