@@ -94,10 +94,12 @@ async function runPodInstall(options: {
9494
9595 const shouldHandleRepoUpdate = options ?. shouldHandleRepoUpdate || true ;
9696 const loader = spinner ( { indicator : 'timer' } ) ;
97+ loader . start ( 'Installing CocoaPods dependencies' ) ;
98+
99+ const command = options . useBundler ? 'bundle' : 'pod' ;
100+ const args = options . useBundler ? [ 'exec' , 'pod' , 'install' ] : [ 'install' ] ;
101+
97102 try {
98- loader . start ( 'Installing CocoaPods dependencies' ) ;
99- const command = options . useBundler ? 'bundle' : 'pod' ;
100- const args = options . useBundler ? [ 'exec' , 'pod' , 'install' ] : [ 'install' ] ;
101103 await spawn ( command , args , {
102104 env : {
103105 RCT_NEW_ARCH_ENABLED : options . newArch ? '1' : '0' ,
@@ -127,13 +129,23 @@ async function runPodInstall(options: {
127129 useBundler : options . useBundler ,
128130 } ) ;
129131 } else {
130- loader . stop ( 'CocoaPods installation failed. ' , 1 ) ;
132+ if ( options . useBundler ) {
133+ // If for any reason the installing with bundler failed, try with pure `pod install`
134+ await runPodInstall ( {
135+ shouldHandleRepoUpdate : false ,
136+ sourceDir : options . sourceDir ,
137+ newArch : options . newArch ,
138+ useBundler : false ,
139+ } ) ;
140+ } else {
141+ loader . stop ( 'CocoaPods installation failed. ' , 1 ) ;
131142
132- throw new RnefError (
133- `CocoaPods installation failed. Please make sure your environment is correctly set up.
143+ throw new RnefError (
144+ `CocoaPods installation failed. Please make sure your environment is correctly set up.
134145Learn more at: ${ color . dim ( 'https://cocoapods.org/' ) } ` ,
135- { cause : stderr }
136- ) ;
146+ { cause : stderr }
147+ ) ;
148+ }
137149 }
138150 }
139151
0 commit comments