简体   繁体   中英

How to use two ruby,rails version on same machine but different project?

Right now I have a project demo on my Desktop with versions

Ruby-2.6.3p62
Rails-4.2.11.3
Gem-3.0.3

and I want to create an another project new on my Desktop with versions

ruby-3.1.1p18
Rails-7.0.2.3
Gem-3.3.13

and currently, I have this rbenv version

rbenv version
2.6.3 (set by /home/akshit/.rbenv/version)

Can you share the commands on how to create project new without affecting my project demo ?

Using rbenv do this:

  • create project new
  • open a terminal inside root folder
  • write rbenv install 3.1.1 and then rbenv local 3.1.1 so for this project it will use the specified version

I suggest you to create a .ruby-version file where you set the project's ruby version, in this case 3.1.1

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