Techioz Blog

反応ネイティブプロジェクトの作成中にRubyバージョンエラーが発生しました

概要

Mac で新しい反応ネイティブ プロジェクトを作成しようとしていますが、Ruby バージョン 3.1.2 があるにもかかわらず、このエラーが発生します。どうすればこれを解決できますか?

✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing Bundler
error Your Ruby version is 2.6.8, but your Gemfile specified >= 2.6.10

✖ Installing Bundler
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
    at createFromTemplate (/Users/tanjilpranto/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:131:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.initialize [as func] (/Users/tanjilpranto/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:184:3)
    at async Command.handleAction (/Users/tanjilpranto/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.
tanjilpranto@Tanjils-MacBook-Pro ~ % ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
tanjilpranto@Tanjils-MacBook-Pro ~ % 

rbenv、rvmを使用してみましたが、毎回同じことが起こります

解決策

このように反応ネイティブをインストールします npx 反応ネイティブ @最新の init プロジェクト名 その後、Ruby バージョン 2.7.5 の反応ネイティブで gem ファイルの名前を変更します。これは私にとってはうまくいきます このルビー「2.7.5」のように、これが役立つことを願っています