I'm confused: 'rails -v' and 'gem list' show different versions

强颜欢笑 提交于 2020-01-06 01:36:10

问题


I've made a fresh installation of Ruby on Rails on my Windows 7 machine (using RailsInstaller) after a failed attempt to follow Michael Hartl's Ruby on Rails Tutorial (if you're interested, see my previous question pertaining to the said fail).

As I thought my previous fail had something to do with my inept attempt at installing different gem versions hoping to replicate requirements laid out in the tutorial, I decided to check the version of rails gem immediately after the install.

When I typed

rails -v

I got Rails 4.0.2 as a response, but when I did

gem list

it said rails (3.2.16), and that got me really confused.

Are we talking about two different things here?

Mind you that this is a crisp install: these two commands were the first, and the only two commands I ever typed.

Can this be the reason I couldn't boot WEBrick for my sample project?

Thanks!


回答1:


The reason you are seeing this is the Railties executable wrapper is still installed. You need to uninstall the Rails gem and and the Railties gem.

$ gem uninstall rails
$ gem uninstall railties

You will likely be prompted to select which version of the gem to uninstall.

If needed, you can reinstall a specific version of Rails.

$ gem install rails -v 3.2.16
$ gem install railties -v 3.2.16



回答2:


gem list will show all gems you've installed. If you have multiple versions of rails installed it will show them.



来源:https://stackoverflow.com/questions/20830622/im-confused-rails-v-and-gem-list-show-different-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!