web-dev-qa-db-fra.com

Gem :: InstallError: rubyzip nécessite Ruby version> = 2.4

J'ai rencontré cette erreur lors de l'installation de Ruby on Rails. Il dit que cela nécessite Ruby version> = 2.4 et je ne comprends pas très bien comment résoudre ce problème.) . J'ai téléchargé le paquet railsinstaller et le Ruby dans sa version 2.3.3. Je suis actuellement en train de suivre le tutoriel de https://www.youtube.com/watch?v = 3D9d0wmwHVQ mais la vidéo ne précise pas le problème que j'ai rencontré ici. Quelqu'un peut-il me donner quelques suggestions s'il vous plaît? Merci!

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

2
Roy Xu

Le problème vient de la version de rubyzip

Vous devez utiliser la version 2.0.0 de rubyzip qui nécessite la Ruby version >=2.4.0 - Réf

Pour le faire fonctionner avec Ruby 2.3.3 vous devez rétrograder le rubyzip en 1.3.0 - Réf

Ajoutez ceci à votre Gemfile

gem 'rubyzip', '~> 1.3.0'

[~ # ~] modifier [~ # ~]

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.

Dans le journal, vous pouvez voir que bundler essaie d'installer rubyzip 2.0.0 il suffit de le verrouiller sur 1.3.0 et vous êtes bon.

Pour référence future, si vous rencontrez un problème similaire, vérifiez simplement la spécification de la gemme là-bas, vous trouverez la version Ruby version et quelques autres dépendances

0
Deepak Mahakale