简体   繁体   English

如何在同一台机器但不同的项目上使用两个 ruby,rails 版本?

[英]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现在我的Desktop上有一个带有版本的project demo

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我想在我的Desktop上创建另一个带有版本的project new

ruby-3.1.1p18
Rails-7.0.2.3
Gem-3.3.13

and currently, I have this rbenv version目前,我有这个rbenv版本

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 ?您能否分享有关如何在不影响我的project demo的情况下创建project new的命令?

Using rbenv do this:使用 rbenv 这样做:

  • create project new 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 versionrbenv install 3.1.1然后rbenv local 3.1.1所以对于这个项目它将使用指定的版本

I suggest you to create a .ruby-version file where you set the project's ruby version, in this case 3.1.1我建议您创建一个.ruby-version文件,您可以在其中设置项目的 ruby 版本,在本例中为 3.1.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在同一开发机器上运行不同的Ruby版本和Rails版本 - How to Run different Ruby versions and Rails version on same development machine 如何配置Rails使用不同版本的Ruby? - How to configure Rails to use different version of Ruby? 如何在 asdf 中的同一个 ruby​​ 版本上使用同一个 gem 的两个版本? - How to use two versions of the same gem on the same ruby version in asdf? 是否可以由两个在不同OS上但在相同Rails版本上工作的开发人员在Rails项目上工作 - Is it possible to work on a rails project by two developers working on different OS but on same rails version 如何更新旧 Rails 项目上的 ruby​​ 版本 - How update the ruby version on a old rails project 同一台机器上的多个Rails版本 - Multiple Rails version in the same machine Ruby on Rails - 如何在我的项目中设置默认的 ruby 版本? - Ruby on Rails - How to set the default ruby version in my project? 在同一 Ruby on Rails 视图中同时使用两种不同型号的最佳方法? - Best approach to use two different models simultaneously in the same Ruby on Rails view? 如何使用来自同一Rails模型上两个不同宝石的具有相同“名称”的两种不同方法? - How to use two different method with the same “name” from two different gems on the same rails model? 如果我在我的机器上运行不同版本的 Ruby,如何测试从 GitHub 克隆的某人的 Rails 应用程序? - How can I test someone's Rails app cloned from GitHub if I am running a different version of Ruby on my machine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM