npx react-native@latest init エラー Ruby gem のインストール
概要
M1 Mac で反応ネイティブ CLI アプリを作成しようとすると、Ruby Gems のインストール中にエラーが発生しました。
✖ Installing Ruby Gems
error There was an error while trying to write to
/Users/maciejwiacek/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions.61581.tmp.
It is likely that you need to grant write permissions for that path.
✖ Installing Ruby Gems
error Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/environment-setup?os=macos&platform=android and follow the React Native CLI QuickStart guide for macOS and iOS.
MacOS、cocoapods、Ruby バージョン、Homebrew、Watchman などを再インストールしてみました。
解決策
ルビーとココアポッドはありますか?公式ガイドには、場合によっては sudo を使用する必要があると記載されています。私はこのガイドのおかげでインストールされた Ruby Version Manager を使用していますが、以前は、多くの人がこの習慣を妨げていたとしても、sudo で作業を完了するだけでした。