λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
IT-Engineering/TroubleShooting

Something went wrong running `pod install` in the `ios` directory 문제 ν•΄κ²° κ³Όμ • 기둝(feat. React Native)

by 🧞‍♂️ 2024. 4. 7.
λ°˜μ‘ν˜•

 

μž‘μ—… 쀑에 λ‹€μŒμ˜ μ—λŸ¬κ°€ λ°œμƒν–ˆλ‹€. ios μ—…λ°μ΄νŠΈ 이후 μ΄μƒν•˜κ²Œ μ—λŸ¬λ“€μ΄ 많이 λ°œμƒν•˜λŠ” λ“―ν•˜λ‹€.

 Something went wrong running `pod install` in the `ios` directory

μ’€ 더 κΈΈκ²ŒλŠ” npx λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν•˜λ˜ μƒν™©μ΄μ—ˆλ‹€.

npx create-react-native-app
βœ” What is your app named? … my-react-app
βœ” How would you like to start › Default new app
βœ” Downloaded and extracted project files.

Using Yarn to install packages. You can pass --use-npm to use npm instead.

βœ” Installed JavaScript dependencies.
⚠️  Something went wrong running `pod install` in the `ios` directory. Continuing with initializing the project, you can debug this afterwards.

문제λ₯Ό μ°Ύμ•„λ³΄λ‹ˆ cocoapodsλΌλŠ” λ†ˆμ΄ 문제라고 ν•œλ‹€. μ•„λž˜μ™€ 같은 λͺ…λ Ήμ–΄λ₯Ό 톡해 ν•΄λ‹Ή νŒ¨ν‚€μ§€λ₯Ό λ‹€μ‹œ μ„€μΉ˜ν•΄μ£Όμž.

sudo gem install cocoapods

λ‚΄ κ²½μš°μ— μ˜μ‘΄μ„±μ΄ 많이 κΉ¨μ Έμžˆμ–΄ λ‹€μŒκ³Ό 같은 μ—λŸ¬κ°€ 났닀.

ERROR:  Error installing cocoapods:
    The last version of drb (>= 0) to support your Ruby & RubyGems was 2.0.6. Try installing it with `gem install drb -v 2.0.6` and then running the current command again
    drb requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.

문제λ₯Ό ν•΄κ²°ν•˜κΈ° μœ„ν•΄ λ‹€μ‹œ μ•„λž˜μ˜ νŒ¨ν‚€μ§€λ₯Ό λ‹€μŒκ³Ό 같이 μ„€μΉ˜ν–ˆλ‹€.

sudo gem install drb -v 2.0.6

λ‹€μ‹œ cocoapods μ„€μΉ˜ λͺ…λ Ήμ–΄λ₯Ό μž¬μ‹€ν–‰ν–ˆλ‹€.
κ·ΈλŸ¬λ‚˜, μΆ”κ°€ μ—λŸ¬ λ°œμƒ...!

ERROR:  Error installing cocoapods:
    The last version of activesupport (>= 5.0, < 8) to support your Ruby & RubyGems was 6.1.7.7. Try installing it with `gem install activesupport -v 6.1.7.7` and then running the current command again
    activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.

μ΄λ²ˆμ—λŠ” μ•„λž˜μ™€ 같이 λ‹€μ‹œ νŒ¨ν‚€μ§€ μ„€μΉ˜λ₯Ό λ‹€μ‹œ ν–ˆλ‹€.

sudo gem install activesupport -v 6.1.7.7

이후에 λ‹€μ‹œ cocodpodsλ₯Ό μ„€μΉ˜ν•˜λ‹ˆ 정상 μ„€μΉ˜ μ™„λ£Œ!

μ•žμ„œ λ¬Έμ œκ°€ μƒκ²Όλ˜ React Native App ν΄λ”λ‘œ λ“€μ–΄κ°€μ„œ ν•΄λ‹Ή ν΄λ”λ‚΄μ˜ ios ν΄λ”λ‘œ λ‹€μ‹œ μ§„μž… ν›„ μ•„λž˜μ˜ λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν–ˆλ‹€.

μ–΅,, 그런데 아직도 살짝 λ¬Έμ œκ°€ λ‚¨μ•„μžˆλ‹€. Xcode λ¬Έμ œλ‹€.

pod install
Using Expo modules
[Expo] Enabling modular headers for pod ExpoModulesCore
(node:75985) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Framework build type is static library
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
[Codegen] Found rncore
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
[!] Failed to load 'glog' podspec:
[!] Invalid `glog.podspec` file: undefined method `[]' for nil.

 #  from /Users/sark/dev/react-native/my-react-app/node_modules/react-native/third-party-podspecs/glog.podspec:38
 #  -------------------------------------------
 #    match = xcode_path.match(/Xcode (\d+)\.(\d+)/)
 >    major_version = match[1].to_i
 #    minor_version = match[2].to_i
 #  -------------------------------------------

이번 λ¬Έμ œλŠ” μ•„λž˜μ˜ 두가지 λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν•˜λ©΄ 해결이 λ˜μ—ˆλ‹€.

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

xcode 경둜λ₯Ό 이와같이 λ‹€μ‹œ μž‘μ•„μ€€ 뒀에

xcode-select -p

ν•΄λ‹Ή λͺ…λ Ήμ–΄λ₯Ό 톡해 정상 지정 λ˜μ—ˆλŠ”μ§€ 확인이 λœλ‹€. μ•„λž˜μ™€ 같이 확인이 될 것이닀.

/Applications/Xcode.app/Contents/Developer

이제 λ‹€μ‹œ pod install을 μˆ˜ν–‰ν•˜λ©΄ μ •μƒμ μœΌλ‘œ 잘 될 것이닀. 문제 ν•΄κ²° 끝.

λ°˜μ‘ν˜•

λŒ“κΈ€