本文介绍了使用自制软件切换到其他版本的红宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Migration Assistant迁移了MacBook.我在以前的笔记本电脑上使用过两个Rails应用程序,现在当我尝试在新笔记本电脑上使用这些应用程序时,其中一个可以正常使用(Restaurant App),而另一个(Quiz App)则可以打开服务器.得到这个

I migrated my MacBook using Migration Assistant. I have two rails apps I was working on my previous laptop and now when I try working on those apps on my new laptop one them works properly(Restaurant App) and in the other(Quiz App) when I try to turn on the server I get this

Your Ruby version is 2.2.3, but your Gemfile specified 2.5.1

这两个应用程序都具有ruby版本2.5.1.我可以在一个应用程序(餐厅应用程序)上运行服务器,而不能在另一个应用程序(测验应用程序)上运行服务器的可能原因.

Both the apps have ruby version 2.5.1. What could be the possible reason the I am able to run the server on one app(Restaurant App) and not the other(Quiz App).

我尝试运行下面的命令将ruby版本切换到2.5.1

I tried running the command below to switch the ruby version to 2.5.1

brew unlink [email protected] && brew link --force --overwrite [email protected]

但是我得到一个错误

No such keg: /usr/local/Cellar/[email protected]

请帮助我解决这个问题.

Please help me figure out this problem.

推荐答案

通常,最好使用ruby版本管理器.两个主要的是RVM( https://rvm.io/)和rbenv

Generally you're better off using a ruby version manager. The two major ones being RVM (https://rvm.io/) and rbenv

我个人是rbenv及其对垫片的使用的忠实拥护者(使用捆绑程序并通过xcversion亲自切换xcode版本时,我的麻烦较少) https://github.com/rbenv/rbenv

I'm personally a big fan of rbenv and its use of shims (I have less trouble when using bundler and switching xcode versions via xcversion personally) https://github.com/rbenv/rbenv

brew install rbenv 
rbenv install 2.5.1
rbenv use 2.5.1

(可选)您可以在项目根目录中使用.ruby-version文件,以确保再次没有问题. https://github.com/rbenv/rbenv#choosing-the-ruby-版本

optionally you can use a .ruby-version file in your project root to ensure you don't have an issue again. https://github.com/rbenv/rbenv#choosing-the-ruby-version

# in your project root
echo '2.5.1' > .ruby-version

通过这种方式,只需在项目根目录中启动它,就可以轻松选择要用于应用程序的版本.

In this way you can easily select whichever version you'd like to use for your application, just by starting it in the project root.

这篇关于使用自制软件切换到其他版本的红宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 06:41