简体   繁体   中英

Do I have to install Ruby from source to get Ruby 2.2.0 and Rails 4.2.0 installed on my windows machine?

I currently have Ruby 2.2.6 and Rails 5.0.1 installed on my Windows 10 machine. I have cloned an existing project that has the following settings included in its Gemfile:

# Lock-in Lang and Framework:
ruby '2.2.0'
gem 'rails', '4.2.0'

I'm having a surprisingly hard time figuring out how to get Ruby 2.2.0 and Rails 4.2.0 installed. Ruby has good documentation of different installation options , but I think I've exhausted the Windows options without any success. Here are a couple I tried:

  • Installers: I couldn't find an option for downloading either from RailsInstaller , RubyInstaller , and Bitnami .
  • RVM: I tried (unsuccessfully) following this blog post to install cygwin so that I could use RVM, but then saw in the comments that the author now recommends spinning up a linux VM rather that using this method.
  • Pik and Uru : It appears Pik is no longer maintained, and I couldn't figure how to download new versions and ruby and rails with Uru as opposed to managing already downloaded versions.

EDIT: I also tried simply changing the version numbers for ruby and rails in the Gemfile to 2.2.6 and 5.0.1. When I do this I (very understandably) get a message when I try to use a rails command saying I need to run bundle update rails . When I run that rails update I get the following error: Bundler could not find compatible versions for gem "rack" . I've done some googling on that option, and it looks like resolving that issue might be possible but requires some more involved tinkering with my Gemfile configuration.

I think my next option is to install Ruby from the source, but I wanted to throw a question up here first to make sure I'm not missing an easier method. So my question is - is it really this hard to get an older minor release of ruby and rails installed on Windows? I realize that the majority of users are probably looking for the most recent release, but it doesn't seem to me that my use case is terribly unique.

The oldest available Ruby 2.2.x via RubyInstaller is 2.2.1 So, the answer to your question is, "Yes, you'll have to build from source."

But then again, v2.x of gem "rack" requires at least Ruby v2.2.2

And depending on what other gems are included in your Gemfile , you'll still have to reconfigure your Gemfile to get this app running.

So the best solution is probably to use the latest patch version of Ruby 2.2.x and lock rails to 4.2.x . (The app may not be compatible with Rails 5.x )

# Lock-in Lang and Framework:

ruby '2.2.6'
gem 'rails', '~> 4.2'

Then run bundle install to install all the gems required by the Gemfile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM