服务器启动时如何修复“您的 Ruby 版本为 2.3.0,但您的 Gemfile 指定为 2.2.5”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37914702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting
回答by Tan
You better install Ruby 2.2.5 for compatibility. The Ruby version in your local machine is different from the one declared in Gemfile.
为了兼容性,您最好安装 Ruby 2.2.5。您本地机器中的 Ruby 版本与 Gemfile 中声明的版本不同。
If you're using rvm:
如果您使用rvm:
rvm install 2.2.5
rvm use 2.2.5
else if you're using rbenv:
否则,如果您使用rbenv:
rbenv install 2.2.5
rbenv local 2.2.5
else if you can not change ruby version by rbenv, read here
否则,如果您无法通过 rbenv 更改 ruby 版本, 请阅读此处
回答by Tarique
If you have already installed 2.2.5 and set as current ruby version, but still showing the same error even if the Ruby version 2.3.0 is not even installed, then just install the bundler.
如果您已经安装了 2.2.5 并设置为当前的 ruby 版本,但即使没有安装 Ruby 版本 2.3.0 仍然显示相同的错误,那么只需安装捆绑程序。
gem install bundler
and then:
进而:
bundle install
回答by Ed de Almeida
Your Gemfilehas a line reading
你的Gemfile有一行读数
ruby '2.2.5'
Change it to
将其更改为
ruby '2.3.0'
Then run
然后运行
bundle install
回答by kahcv
If you are using rbenv then make sure that you run the "rbenv rehash" command after you set local or global ruby version. It solved the issue for me.
如果您使用 rbenv,请确保在设置本地或全局 ruby 版本后运行“rbenv rehash”命令。它为我解决了这个问题。
rbenv rehash
回答by blnc
Add the following to your Gemfile
将以下内容添加到您的Gemfile 中
ruby '2.3.0'
回答by villy393
I am on Mac OS Sierra. I had to update /etc/pathsand add /Users/my.username/.rbenv/shimsto the top of the list.
我在 Mac OS Sierra 上。我不得不更新/etc/paths并添加/Users/my.username/.rbenv/shims到列表的顶部。
回答by Arushi Singhal
For $Your Ruby version is 2.3.0, but your Gemfile specified 2.4.1.
Changed 2.4.1 in Gemfile to 2.3.0
对于$您的 Ruby 版本是 2.3.0,但您的 Gemfile 指定为 2.4.1。将 Gemfile 中的 2.4.1 更改为 2.3.0


