创建react native项目时出现ruby版本错误

nqwrtyyt  于 2023-10-18  发布在  Ruby
关注(0)|答案(1)|浏览(178)

我试图在我的mac上创建一个新的react native项目,但得到这个错误,尽管我有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,但仍然是同样的事情发生每一次

qmelpv7a

qmelpv7a1#

安装react native,如下所示npx react-native@latest init项目名称,在react native中重命名gem文件后,使用ruby 2.7.5版,这对我来说很有效,如下所示ruby“2.7.5”,希望这能有所帮助

相关问题