Ubuntu Server 20.04 Redmine 错误 Ruby 版本

Ubuntu Server 20.04 Redmine 错误 Ruby 版本

已完成从 18.04 到 20.04 的升级,其中我安装了 Redmine,升级完成后,Redmine 停止了。

当我尝试访问时出现错误:

Could not find concurrent-ruby-1.1.9 in any of the sources (Bundler::GemNotFound)

错误回溯:

/usr/lib/ruby/2.7.0/bundler/spec_set.rb:86:in `block in materialize'
/usr/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `map!'
/usr/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `materialize'
/usr/lib/ruby/2.7.0/bundler/definition.rb:170:in `specs'
/usr/lib/ruby/2.7.0/bundler/definition.rb:237:in `specs_for'
/usr/lib/ruby/2.7.0/bundler/definition.rb:226:in `requested_specs'
/usr/lib/ruby/2.7.0/bundler/runtime.rb:101:in `block in definition_method'
/usr/lib/ruby/2.7.0/bundler/runtime.rb:20:in `setup'
/usr/lib/ruby/2.7.0/bundler.rb:149:in `setup'
/usr/lib/ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
/usr/lib/ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
/usr/lib/ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
/usr/lib/ruby/2.7.0/bundler/setup.rb:20:in `<top (required)>'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:365:in `activate_gem'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:529:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:91:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:382:in `run_block_and_record_step_progress'
/usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

当我运行 bundle install 时,看起来一切正常:

Your Gemfile lists the gem redmine_crm (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using i18n 0.7.0
Using minitest 5.14.4
Using thread_safe 0.3.6
Using tzinfo 1.2.9
Using activesupport 5.2.3
Using builder 3.2.4
Using erubi 1.10.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.10
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.12.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.3
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 5.2.3
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.5
Using actioncable 5.2.3
Using globalid 0.5.2
Using activejob 5.2.3
Using mini_mime 1.0.3
Using mail 2.7.1
Using actionmailer 5.2.3
Using method_source 1.0.0
Using thor 1.1.0
Using railties 5.2.3
Using actionpack-xml_parser 2.0.1
Using activemodel 5.2.3
Using arel 9.0.0
Using activerecord 5.2.3
Using mimemagic 0.3.10
Using marcel 0.3.3
Using activestorage 5.2.3
Using public_suffix 4.0.6
Using addressable 2.8.0
Using bundler 2.2.25
Using css_parser 1.10.0
Using csv 3.0.9
Using htmlentities 4.3.4
Using liquid 2.6.3
Using mysql2 0.5.3
Using net-ldap 0.16.3
Using ruby-openid 2.3.0
Using rack-openid 1.4.2
Using sprockets 4.0.2
Using sprockets-rails 3.2.2
Using rails 5.2.3
Using rbpdf-font 1.19.1
Using rbpdf 1.19.8
Using redcarpet 3.4.0
Using rubyzip 2.3.2
Using redmine_crm 0.0.55
Using request_store 1.0.5
Using rmagick 2.16.0
Using roadie 3.5.1
Using roadie-rails 1.3.0
Using rouge 3.3.0
Bundle complete! 29 Gemfile dependencies, 62 gems now installed.
Gems in the groups 'development', 'teste', 'test', 'postgresql' and 'sqlite' were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

如果我检查缺少的宝石:

* concurrent-ruby (1.1.9)
        Summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns.
        Homepage: http://www.concurrent-ruby.com
        Source Code: https://github.com/ruby-concurrency/concurrent-ruby
        Changelog: https://github.com/ruby-concurrency/concurrent-ruby/blob/master/CHANGELOG.md
        Path: /usr/share/rvm/gems/ruby-2.5.0/gems/concurrent-ruby-1.1.9

因此看起来 Redmine 正在寻找 ruby​​ 2.7.0 文件夹中的宝石,而我在 2.5.0 文件夹中有宝石。

如果这是问题所在,我该怎么办?强制 redmine 使用 ruby​​ 2.5,这看起来是最好的方法吗?或者强制将 gem 安装在 2.7 版本中,如果是这样,该怎么做?删除 2.5,如果我运行 bundle install,它可以完成工作吗?

当前 GemFile.Lock:

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.2.3)
      actionpack (= 5.2.3)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailer (5.2.3)
      actionpack (= 5.2.3)
      actionview (= 5.2.3)
      activejob (= 5.2.3)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.2.3)
      actionview (= 5.2.3)
      activesupport (= 5.2.3)
      rack (~> 2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionpack-xml_parser (2.0.1)
      actionpack (>= 5.0)
      railties (>= 5.0)
    actionview (5.2.3)
      activesupport (= 5.2.3)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.2.3)
      activesupport (= 5.2.3)
      globalid (>= 0.3.6)
    activemodel (5.2.3)
      activesupport (= 5.2.3)
    activerecord (5.2.3)
      activemodel (= 5.2.3)
      activesupport (= 5.2.3)
      arel (>= 9.0)
    activestorage (5.2.3)
      actionpack (= 5.2.3)
      activerecord (= 5.2.3)
      marcel (~> 0.3.1)
    activesupport (5.2.3)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.8.0)
      public_suffix (>= 2.0.2, < 5.0)
    arel (9.0.0)
    builder (3.2.4)
    capybara (2.18.0)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (>= 2.0, < 4.0)
    childprocess (3.0.0)
    concurrent-ruby (1.1.9)
    crass (1.0.6)
    css_parser (1.10.0)
      addressable
    csv (3.0.9)
    docile (1.1.5)
    erubi (1.10.0)
    globalid (0.5.2)
      activesupport (>= 5.0)
    htmlentities (4.3.4)
    i18n (0.7.0)
    json (2.5.1)
    liquid (2.6.3)
    loofah (2.12.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (~> 0.3.2)
    method_source (1.0.0)
    mimemagic (0.3.10)
      nokogiri (~> 1)
      rake
    mini_mime (1.0.3)
    mini_portile2 (2.4.0)
    minitest (5.14.4)
    mocha (1.13.0)
    mysql2 (0.5.3)
    net-ldap (0.16.3)
    nio4r (2.5.8)
    nokogiri (1.10.10)
      mini_portile2 (~> 2.4.0)
    public_suffix (4.0.6)
    puma (3.12.6)
    rack (2.2.3)
    rack-openid (1.4.2)
      rack (>= 1.1.0)
      ruby-openid (>= 2.1.8)
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (5.2.3)
      actioncable (= 5.2.3)
      actionmailer (= 5.2.3)
      actionpack (= 5.2.3)
      actionview (= 5.2.3)
      activejob (= 5.2.3)
      activemodel (= 5.2.3)
      activerecord (= 5.2.3)
      activestorage (= 5.2.3)
      activesupport (= 5.2.3)
      bundler (>= 1.3.0)
      railties (= 5.2.3)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    railties (5.2.3)
      actionpack (= 5.2.3)
      activesupport (= 5.2.3)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.19.0, < 2.0)
    rake (13.0.6)
    rbpdf (1.19.8)
      htmlentities
      rbpdf-font (~> 1.19.0)
    rbpdf-font (1.19.1)
    redcarpet (3.4.0)
    redmine_crm (0.0.55)
      liquid (< 2.6.4)
      rails
      rubyzip
    request_store (1.0.5)
    rmagick (2.16.0)
    roadie (3.5.1)
      css_parser (~> 1.4)
      nokogiri (~> 1.8)
    roadie-rails (1.3.0)
      railties (>= 3.0, < 5.3)
      roadie (~> 3.1)
    rouge (3.3.0)
    ruby-openid (2.3.0)
    rubyzip (2.3.2)
    selenium-webdriver (3.142.7)
      childprocess (>= 0.5, < 4.0)
      rubyzip (>= 1.2.2)
    simplecov (0.14.1)
      docile (~> 1.1.0)
      json (>= 1.8, < 3)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.2)
    sprockets (4.0.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.2)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (1.1.0)
    thread_safe (0.3.6)
    tzinfo (1.2.9)
      thread_safe (~> 0.1)
    websocket-driver (0.7.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    yard (0.9.26)

PLATFORMS
  x86_64-linux

DEPENDENCIES
  actionpack-xml_parser
  bundler (>= 1.5.0)
  capybara (~> 2.13)
  csv (~> 3.0.1)
  i18n (~> 0.7.0)
  mail (~> 2.7.1)
  mimemagic
  mini_mime (~> 1.0.1)
  mocha
  mysql2 (~> 0.5.0)
  net-ldap (~> 0.16.0)
  nokogiri (~> 1.10.0)
  puma (~> 3.7)
  rack-openid
  rails (= 5.2.3)
  rails-dom-testing
  rbpdf (~> 1.19.6)
  redcarpet (~> 3.4.0)
  redmine_crm
  request_store (= 1.0.5)
  rmagick (~> 2.16.0)
  roadie-rails (~> 1.3.0)
  rouge (~> 3.3.0)
  ruby-openid (~> 2.3.0)
  selenium-webdriver
  simplecov (~> 0.14.1)
  tzinfo-data
  yard

BUNDLED WITH
   2.2.25

如果我查询 ruby​​ 版本:

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

但我发现我也安装了 2.7 版本。

RVM 信息:

ruby-2.5.0:

  system:
    uname:        "Linux AtomServer 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux"
    name:         "Ubuntu"
    version:      "20.04"
    architecture: "x86_64"
    bash:         "/bin/bash => GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)"
    zsh:          " => not installed"
    remote_path:  "ubuntu/20.04/x86_64"

  rvm:
    version:      "1.29.11 (latest)"
    updated:      "6 months 20 days 7 hours 36 minutes 33 seconds ago"
    path:         "/usr/share/rvm"
    autolibs:     "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."

  ruby:
    interpreter:  "ruby"
    version:      "2.5.0p0"
    date:         "2017-12-25"
    platform:     "x86_64-linux"
    patchlevel:   "2017-12-25 revision 61468"
    full_version: "ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]"

  homes:
    gem:          "/usr/share/rvm/gems/ruby-2.5.0"
    ruby:         "/usr/share/rvm/rubies/ruby-2.5.0"

  binaries:
    ruby:         "/usr/share/rvm/rubies/ruby-2.5.0/bin/ruby"
    irb:          "/usr/share/rvm/rubies/ruby-2.5.0/bin/irb"
    gem:          "/usr/share/rvm/rubies/ruby-2.5.0/bin/gem"
    rake:         "/usr/share/rvm/gems/ruby-2.5.0/bin/rake"

  environment:
    PATH:         "/usr/share/rvm/gems/ruby-2.5.0/bin:/usr/share/rvm/gems/ruby-2.5.0@global/bin:/usr/share/rvm/rubies/ruby-2.5.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jnap/.dotnet/tools:/usr/share/rvm/bin"
    GEM_HOME:     "/usr/share/rvm/gems/ruby-2.5.0"
    GEM_PATH:     "/usr/share/rvm/gems/ruby-2.5.0:/usr/share/rvm/gems/ruby-2.5.0@global"
    MY_RUBY_HOME: "/usr/share/rvm/rubies/ruby-2.5.0"
    IRBRC:        "/usr/share/rvm/rubies/ruby-2.5.0/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

谢谢

答案1

经过反复尝试,找到了解决方案。

因此升级后,一切都变得混乱,版本错误,所以我这样做了:

  1. sudo gem install bundler (bundler 版本较旧)
  2. bundle install(使用新版本的bundler,将gem安装在正确的目录/版本中)

完成这些步骤后,我收到一个新的错误,关于缺少 manifest.js,所以我又做了两件事:

  1. mkdir -p app/assets/config && echo '{}' > app/assets/config/manifest.js
  2. 创建一个新的 Gemfile.local,内容如下: gem "sprockets", "~> 3.7.2"
  3. 捆绑更新

此后,一切正常。

相关内容