Your Ruby version is 2.2.3, but your Gemfile specified 2.2.2

在文章 Ruby On Rails中REST API使用演示样例——基于云平台+云服务打造自己的在线翻译工具 中,从Bluemix上下载的初始Hello World演示样例代码在本地环境下运行调试时提示:Your Ruby version is 2.2.3, but your Gemfile specified 2.2.2

我本地Ruby安装的是2.2.3版本号,而从Bluemix上下载的演示样例是2.2.2版本号,所以出现此问题


怎么解决呢?

我的解决方法是直接改动Gemfile文件里的ruby版本号号,例如以下图:


初学ruby,不知道这是不是最佳的方法。

改动完毕。保存,然后运行:bundle install

输出相似以下所看到的:

C:\ruby\rbtrans>bundle install
Using rake 10.4.2
Using i18n 0.7.0
Using multi_json 1.11.2
Using activesupport 3.2.22
Using builder 3.0.4
Using activemodel 3.2.22
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.7
Using rack-cache 1.5.1
Using rack-test 0.6.3
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.2.3
Using actionpack 3.2.22
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 3.2.22
Using arel 3.0.3
Using tzinfo 0.3.45
Using activerecord 3.2.22
Using activeresource 3.2.22
Using coffee-script-source 1.9.1.1
Using execjs 2.6.0
Using coffee-script 2.4.1
Using rack-ssl 1.3.4
Using json 1.8.3
Using rdoc 3.12.2
Using thor 0.19.1
Using railties 3.2.22
Using coffee-rails 3.2.2
Using jquery-rails 3.1.4
Using bundler 1.10.6
Using rails 3.2.22
Using sass 3.4.19
Using sass-rails 3.2.6
Using uglifier 2.7.2
Bundle complete! 5 Gemfile dependencies, 39 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
然后运行:rails server 就能够启动Web服务器了

C:\ruby\rbtrans>rails server
=> Booting WEBrick
=> Rails 3.2.22 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2015-12-22 20:55:34] INFO  WEBrick 1.3.1
[2015-12-22 20:55:34] INFO  ruby 2.2.3 (2015-08-18) [x64-mingw32]
[2015-12-22 20:55:34] INFO  WEBrick::HTTPServer#start: pid=15980 port=3000




posted @ 2017-06-14 11:01  yfceshi  阅读(1293)  评论(0编辑  收藏  举报