1
votes

I try to create a new Rails application with Rails 4.2:

$ rails _4.2_ new my_app

I get the following error:

/Users/myuser/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'railties' (= 4.2) - did find: [railties-4.2.7.1,railties-4.1.10,railties-4.1.5,railties-4.1.0.beta2] (Gem::LoadError)

These are the railties I have:

$ gem list | grep railties
railties (4.2.7.1, 4.1.10, 4.1.5, 4.1.0.beta2)

Why is it demanding that I use railties 4.2 and not one of the others I have, such as 4.2.7.1?

2

2 Answers

0
votes

gem install railties - it should fix your problem. At least it helped me

0
votes

You get the error because you have explicitly specified that you want to use the rails executable from the gem with version 4.2 on your command line.

Rubygems doesn't resolve approximate versions here. Instead, you have to specify the exact version you want to use (or omit the version from the command line to use the executable from the newest version of the gem installed.

Thus, you can use

rails _4.2.7.1_ new my_app

or (given that Rails 4.2.7.1 is the newest version of the rails gem installed to your computer), you can also just use

rails new my_app