So I installed Ruby and Rails through this video (https://www.youtube.com/watch?v=fmyvWz5TUWg&t=9163s&ab_channel=freeCodeCamp.org) and I was making a new Rails app by using the command rails new <name of the project>
. At the end, the app is created, but there are these errors at the end:
Bundle complete! 15 Gemfile dependencies, 73 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run bundle binstubs bundler
rails importmap:install
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/definition.rb:442:in `validate_ruby!': Your
Ruby version is 3.2.2, but your Gemfile specified 3.1.2 (Bundler::RubyVersionMi smatch)
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/definition.rb:417:in `validate _runtime!'
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler.rb:165:in `setup'
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/setup.rb:23:in `block in <top (required)>'
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/ui/shell.rb:159:in `with_level '
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/ui/shell.rb:111:in `silence'
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/setup.rb:23:in `<top (required )>'
from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_req uire.rb>:85:in `require'
from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_req uire.rb>:85:in `require'
from D:/railsfriends/friends/config/boot.rb:3:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
rails turbo:install stimulus:install
C:/Ruby32-x64/lib/ruby/3.2.0/bundler/definition.rb:442:in `validate_ruby!': Your
Ruby version is 3.2.2, but your Gemfile specified 3.1.2 (Bundler::RubyVersionMi smatch)
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/definition.rb:417:in `validate _runtime!'
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler.rb:165:in `setup'
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/setup.rb:23:in `block in <top (required)>'
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/ui/shell.rb:159:in `with_level '
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/ui/shell.rb:111:in `silence'
from C:/Ruby32-x64/lib/ruby/3.2.0/bundler/setup.rb:23:in `<top (required )>'
from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_req uire.rb>:85:in `require'
from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_req uire.rb>:85:in `require'
from D:/railsfriends/friends/config/boot.rb:3:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
It seems like this error is about the version of ruby, but what should I do to resolve this? Would this error affect me in any way?
EDIT
I went to the Gemfile of the project, and changed from ruby "3.1.2" to ruby "3.2.2", then deleted the whole project and create a new project again using rails new <project_name>
. And then I got this:
Bundle complete! 15 Gemfile dependencies, 73 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run bundle binstubs bundler
rails importmap:install
Add Importmap include tags in application layout
insert app/views/layouts/application.html.erb
Create application.js module as entrypoint
create app/javascript/application.js
Use vendor/javascript for downloaded pins
create vendor/javascript
create vendor/javascript/.keep
Ensure JavaScript files are in the Sprocket manifest
append app/assets/config/manifest.js
Configure importmap paths in config/importmap.rb
create config/importmap.rb
Copying binstub
create bin/importmap
rails turbo:install stimulus:install
Import Turbo
append app/javascript/application.js
Pin Turbo
append config/importmap.rb
Create controllers directory
create app/javascript/controllers
create app/javascript/controllers/index.js
create app/javascript/controllers/application.js
create app/javascript/controllers/hello_controller.js
Import Stimulus controllers
append app/javascript/application.js
Pin Stimulus
Appending: pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true"
append config/importmap.rb
Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
append config/importmap.rb
Pin all controllers
Appending: pin_all_from "app/javascript/controllers", under: "controllers"
append config/importmap.rb
Run turbo:install:redis to switch on Redis and use it in development for turbo streams
Now when I go check for the Gemfile of this newly created project, it now has ruby "3.2.2". So is everything working normal now?
2
Answers
Check your instaled version with
ruby -v
in terminal and also check a file challed Gemline, there is a ruby version inside this file.Your installed ruby version and Gem file ruby version must be the same
Well the easy answer is just to say you can either change the version requirement in Gemfile, or else install the version that Gemfile is specifying.
However, I strongly urge you to remove your ruby installation, install a ruby version manager (RVM, or probably RBenv is the more popular these days) and manage your ruby installations this way. It’s much easier to do it early in your Ruby adventure than later.