Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gem::InstallError: rubyzip requires Ruby version >= 2.4

I ran into this error while installing ruby on rails. It says that it requires Ruby version >= 2.4 and I do not quite understand how I should solve this. I downloaded the railsinstaller packet and the ruby in it is version 2.3.3. I am currently following the tutorial from https://www.youtube.com/watch?v=3D9d0wmwHVQ but the video does not specify the problem that I encountered here. Can anyone give me some suggestions please? Thanks!

Xu Zeng@DESKTOP-32TIA1V MINGW64 /c/railstest
$ rails new tester
      create
      create  README.md
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in C:/railstest/tester/.git/
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/javascripts/application.js
      create  app/assets/javascripts/cable.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images/.keep
      create  app/assets/javascripts/channels
      create  app/assets/javascripts/channels/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/update
      create  bin/yarn
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/cable.yml
      create  config/puma.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults_5_1.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  tmp
      create  tmp/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  vendor/.keep
      create  package.json
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_5_1.rb
         run  bundle install
Fetching gem metadata from https://rubygems.org/................
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Fetching rake 13.0.1
Installing rake 13.0.1
Fetching concurrent-ruby 1.1.5
Installing concurrent-ruby 1.1.5
Fetching minitest 5.13.0
Installing minitest 5.13.0
Using thread_safe 0.3.6
Fetching builder 3.2.4
Installing builder 3.2.4
Fetching erubi 1.9.0
Installing erubi 1.9.0
Fetching mini_portile2 2.4.0
Installing mini_portile2 2.4.0
Fetching crass 1.0.5
Installing crass 1.0.5
Fetching rack 2.0.8
Installing rack 2.0.8
Fetching nio4r 2.5.2
Installing nio4r 2.5.2 with native extensions
Fetching websocket-extensions 0.1.4
Installing websocket-extensions 0.1.4
Fetching mini_mime 1.0.2
Installing mini_mime 1.0.2
Using arel 8.0.0
Fetching public_suffix 4.0.1
Installing public_suffix 4.0.1
Fetching bindex 0.8.1
Installing bindex 0.8.1 with native extensions
Using bundler 1.15.3
Fetching byebug 11.0.1
Installing byebug 11.0.1 with native extensions
Fetching childprocess 3.0.0
Installing childprocess 3.0.0
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Fetching method_source 0.9.2
Installing method_source 0.9.2
Fetching thor 1.0.1
Installing thor 1.0.1
Fetching ffi 1.11.3 (x86-mingw32)
Installing ffi 1.11.3 (x86-mingw32)
Fetching puma 3.12.2
Installing puma 3.12.2 with native extensions
Fetching rb-fsevent 0.10.3
Installing rb-fsevent 0.10.3
Fetching rubyzip 2.0.0
Installing rubyzip 2.0.0
Fetching tilt 2.0.10
Installing tilt 2.0.10
Fetching sqlite3 1.4.2
Installing sqlite3 1.4.2 with native extensions
Fetching turbolinks-source 5.2.0
Installing turbolinks-source 5.2.0
Fetching i18n 1.7.0
Installing i18n 1.7.0
Fetching tzinfo 1.2.6
Installing tzinfo 1.2.6
Fetching nokogiri 1.10.7 (x86-mingw32)
Installing nokogiri 1.10.7 (x86-mingw32)
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Using websocket-driver 0.6.5
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using coffee-script 2.4.1
Fetching uglifier 4.2.0
Installing uglifier 4.2.0
Fetching rb-inotify 0.10.1
Installing rb-inotify 0.10.1
Gem::InstallError: rubyzip requires Ruby version >= 2.4.
An error occurred while installing rubyzip (2.0.0), and Bundler cannot continue.
Make sure that `gem install rubyzip -v '2.0.0'` succeeds before bundling.

In Gemfile:
  selenium-webdriver was resolved to 3.142.6, which depends on
    rubyzip

Xu Zeng@DESKTOP-32TIA1V MINGW64 /c/railstest
$ gem install bundler
Successfully installed bundler-2.1.2
Parsing documentation for bundler-2.1.2
Installing ri documentation for bundler-2.1.2
Done installing documentation for bundler after 6 seconds
1 gem installed

like image 562
Roy Xu Avatar asked Dec 27 '19 06:12

Roy Xu


2 Answers

Deepak already wrote in his answer how to work–around this problem. But I think it might be better to use a different approach.

There is a big issue with the versions from RailsInstaller. They are all outdated and install versions of Ruby and Ruby on Rails that have already reached end-of-life. I recommend not using RailsInstaller at all.

I suggest following the official Ruby Documentation about Installation and use the RubyInstaller to install Ruby. After that just install the latest Ruby on Rails gem with

gem install bundler
gem install rails

from your command line.

like image 197
spickermann Avatar answered Oct 13 '22 21:10

spickermann


The problem is with the version of rubyzip

You must be using the version 2.0.0 of rubyzip which requires the ruby version >=2.4.0 - Ref

In order to make it work with ruby 2.3.3 you need to downgrade the rubyzip to 1.3.0 - Ref

Add this to your Gemfile

gem 'rubyzip', '~> 1.3.0'

EDIT

Gem::InstallError: rubyzip requires Ruby version >= 2.4.
An error occurred while installing rubyzip (2.0.0), and Bundler cannot continue.
Make sure that `gem install rubyzip -v '2.0.0'` succeeds before bundling.

In the log you can see bundler is trying to install rubyzip 2.0.0 just lock it to 1.3.0 and you are good.

For future reference, if you face similar issue just check the gemspec of the gem there you will find the required ruby version and some other dependencies

like image 26
Deepak Mahakale Avatar answered Oct 13 '22 20:10

Deepak Mahakale