Gem :: InstallError:rubyzip需要Ruby版本> = 2.4

时间:2019-12-27 06:40:08

标签: ruby-on-rails ruby rubygems

在轨道上安装红宝石时遇到了此错误。它说它需要Ruby版本> = 2.4,而且我不太了解如何解决这个问题。我下载了railsinstaller数据包,其中的ruby版本为2.3.3。我目前正在按照https://www.youtube.com/watch?v=3D9d0wmwHVQ中的教程进行操作,但是视频未说明在此遇到的问题。有人可以给我一些建议吗? 谢谢!

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

3 个答案:

答案 0 :(得分:1)

Deepak已经在他的答案中写了如何解决此问题。但我认为使用其他方法可能会更好。

RailsInstaller中的版本存在很大问题。它们都已过时,并且已经安装了已经到期的Ruby和Ruby on Rails版本。我建议完全不使用它。

我建议遵循官方Ruby Dokumentation about Installation,并使用RubyInstaller安装Ruby。之后,只需安装最新的Ruby on Rails gem

gem install bundler
gem install rails

从您的命令行。

答案 1 :(得分:0)

问题出在rubyzip

的版本上

您必须使用rubyzip的版本2.0.0,该版本需要ruby版本>=2.4.0-Ref

要使其与ruby 2.3.3一起使用,您需要将rubyzip降级到1.3.0-Ref

将此添加到您的Gemfile

gem 'rubyzip', '~> 1.3.0'

编辑

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.

在日志中,您可以看到捆绑程序正在尝试安装rubyzip 2.0.0,只需将其锁定到1.3.0即可。

供以后参考,如果您遇到类似的问题,只需检查gem的gemspec,即可找到所需的红宝石版本和其他一些依赖项

答案 2 :(得分:0)

运行时收到此错误-

sudo gem install fastlane -NV

通过如下安装ruby 2.6.0来解决此问题-

rbenv安装2.6.0

rbenv全局2.6.0

Ran

sudo gem install fastlane -NV

成功了