【问题标题】:Ruby 2.2.3 in 20202020 年的 Ruby 2.2.3
【发布时间】:2020-06-21 04:50:29
【问题描述】:

Ruby 2.2.3 已经死了一段时间,但我被要求查看一个遗留项目以更新和修复它。 为了在 MacOS 或 Ubuntu 上启动并运行本地环境,我无法安装 2.2.3。

错误似乎归结为 openssl ruby​​gems 问题:

来自rubygems.install.log

Exception `LoadError' at /Users/user/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems.rb:1222 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/user/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems.rb:1231 - cannot load such file -- rubygems/defaults/ruby
/Users/user/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)

有人对如何进行有任何建议吗?

【问题讨论】:

  • Ruby 2.x 几乎完全向后兼容。如果它适用于 2.2.3,它很有可能也适用于 2.6 或 2.7。如果您还没有,我建议您尝试在当前的 Ruby 上设置它并看看会发生什么。但是如果你真的想要 2.2.3,你的问题很可能是 Installing ruby-2.1.2: Cannot load such file — openssl (LoadError) 的欺骗。
  • @Amadan 与过时的 mysql gem 之类的东西在 2.3.3 之上存在一些摩擦,但在使用现代依赖项的现代代码库上,我不得不同意没有太多问题。

标签: ruby ruby-2.2


【解决方案1】:

在 MacOS 上,使用 rbenv 而不是 rvm 解决了这个问题,并让我可以转移到另一个主机依赖问题。

【讨论】:

  • 恭喜牦牛剃毛!
【解决方案2】:
$ brew update && brew upgrade 
$ brew doctor 

解决所有 brew doctor 警告,然后继续进行

$ brew uninstall ruby
$ brew install rbenv 
$ brew install ruby-build 
$ echo 'export RBENV_ROOT=/usr/local/var/rbenv' >> ~/.bash_profile
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ rbenv install -l
$ rbenv install 2.2.3
$ rbenv global 2.2.3

【讨论】:

    猜你喜欢
    • 2021-02-17
    • 2021-01-05
    • 2015-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 2021-07-13
    • 2020-10-28
    相关资源
    最近更新 更多