简体   繁体   中英

Installing Ruby version using rbenv

I have been trying to install React Native into my Mac. In the installation docs, it requires Ruby version of 2.7.6 have been to be installed.

I have installed a new Ruby version using rbenv manager and it was successful. But now I cannot switch my machine to new Ruby version. Any help will be highly appreciated.

Thanks!

You have to set the version for the directory where your react project is. You can do this with:

rbenv local 2.7.6

This creates a file called .ruby-version in the directory, which tells rbenv what version of Ruby to use.

This is all visible in the README of rbenv .

You can have a look at this solution

Use the below command to change your ruby version:

rbenv global 3.1.2   # set the default Ruby version for this machine
# or:
rbenv local 3.1.2    # set the Ruby version for this directory

You can find this from rbenv Official Github Repo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM