Your Ruby version is 2.2.3, but your Gemfile specified 2.2.2

来源:互联网 发布:qq加速升级软件 编辑:程序博客网 时间:2024/06/05 03:14

在文章 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 installUsing rake 10.4.2Using i18n 0.7.0Using multi_json 1.11.2Using activesupport 3.2.22Using builder 3.0.4Using activemodel 3.2.22Using erubis 2.7.0Using journey 1.0.4Using rack 1.4.7Using rack-cache 1.5.1Using rack-test 0.6.3Using hike 1.2.3Using tilt 1.4.1Using sprockets 2.2.3Using actionpack 3.2.22Using mime-types 1.25.1Using polyglot 0.3.5Using treetop 1.4.15Using mail 2.5.4Using actionmailer 3.2.22Using arel 3.0.3Using tzinfo 0.3.45Using activerecord 3.2.22Using activeresource 3.2.22Using coffee-script-source 1.9.1.1Using execjs 2.6.0Using coffee-script 2.4.1Using rack-ssl 1.3.4Using json 1.8.3Using rdoc 3.12.2Using thor 0.19.1Using railties 3.2.22Using coffee-rails 3.2.2Using jquery-rails 3.1.4Using bundler 1.10.6Using rails 3.2.22Using sass 3.4.19Using sass-rails 3.2.6Using uglifier 2.7.2Bundle 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




1 0
原创粉丝点击