I specified the version and rails new, but for some reason the latest version is included ~


The purpose of this article is to introduce the procedure for rails new Rails app in the local environment Rails and the error handling that occurred at that time.




1 Check the installed rails version

% rails -v  

2 Check the list of available versions

% gem list rails

rails (,,,

3 Install rails

gem i -v rails

4 Check the version again

% gem list rails                                                                                                                                                                               

*** LOCAL GEMS ***

rails (,,,,

5 "rails new" without loading Gemfile

rails _6.0.3.1_ new SampleApp -d mysql --skip-bundle


---d mysql specifies DB as mysql.

--Enter the version name (number) you want to specify in place of _6.0.3.1_. --new Sample App is the app name. ---- skip-bundle specifies that Gemfile should not be read.

6 Edit Gemfile

At the moment, the local rails version ( in this case) is specified, so edit the Gemfile and change it to the version you want to specify ( in this case).

Before change) gem'rails', '~>'
After change) gem'rails', '='


--~> means that rails 6.0.x.x (6.0 series) can be used, so the latest will be installed in this state.

7 bundle install

% bundle install

Then the following error occurs

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
  In snapshot (Gemfile.lock):
    activesupport (=

  In Gemfile:
    web-console (>= 3.3.0) was resolved to 4.0.4, which depends on
      actionview (>= 6.0.0) was resolved to, which depends on
        activesupport (=

    rails (= was resolved to, which depends on
      activesupport (=

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

Simply put, I get an error saying "If you want to specify rails, you can't use other gems unless you match the version! ".

So, as instructed by the error statement, change the version of other gems with bundle update.

8 bundle update

% bundle update

Check if the specified version of the app can be created

% rails -v

This is the end!


[Rails error] What to do if a higher version is included even if you specify the version with rails new https://techtechmedia.com/rails-new-version-error/

Recommended Posts

I specified the version and rails new, but for some reason the latest version is included ~
repository The specified gem is bundle installed but not updated to the latest version
Enum misconfiguration. For some reason, I can't get data from the column specified by Enum ...
The strong parameter is true, but for some reason it cannot be saved in the table.
What to do if the app is not created with the latest Rails version installed when rails new
In DynamoDB Enhanced Client, I access the index table for some reason
[Rails] I studied the difference between new method, save method, build method and create method.
[Ruby] Your Ruby version is 2.6.3, but your Gemfile specified 2.5.8
Your Ruby version is 2.4.6, but your Gemfile specified 2.6.4
[Rails] I tried to raise the Rails version from 5.0 to 5.2
I summarized the naming conventions for each Rails
[Rails] I learned about the difference between resources and resources
[CentOS] Download and build the specified version of Git
[Rails] What is the difference between redirect and render?
What should I use for the testing framework [Rails]
When the vagrant command doesn't work for some reason
[Rails] I investigated the difference between redirect_to and render.