【问题标题】:How to fix error when installing Ruby using RVM?使用 RVM 安装 Ruby 时如何修复错误?
【发布时间】:2021-05-12 11:21:02
【问题描述】:

我的操作系统是 macOS Catalina 10.15.7,我目前安装了 ruby​​ 2.6.3。

我尝试使用 RVM 安装 Ruby,但它给出了错误。

▶ rvm use ruby --install --default 
> Required ruby-3.0.0 is not installed 
> installing. ruby-3.0.0 - #removing src/ruby-3.0.0 - please
> wait Searching for binary rubies, this might take some time. No binary
> rubies available for: osx/10.15/x86_64/ruby-3.0.0. Continuing with
> compilation. Please read 'rvm help mount' to get more information on
> binary rubies. Checking requirements for osx. Certificates bundle
> '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
> Requirements installation successful. Installing Ruby from source to:
> /Users/soonersoft/.rvm/rubies/ruby-3.0.0, this may take a while
> depending on your cpu(s)... ruby-3.0.0 - #downloading ruby-3.0.0, this
> may take a while depending on your connection... ruby-3.0.0 -
> #extracting ruby-3.0.0 to /Users/soonersoft/.rvm/src/ruby-3.0.0 - please wait ruby-3.0.0 - #configuring - please wait Error running 'env
> CFLAGS=-O3 -I/usr/local/opt/libyaml/include
> -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include LDFLAGS=-L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib
> -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@1.1/lib ./configure --prefix=/Users/soonersoft/.rvm/rubies/ruby-3.0.0 --disable-install-doc --enable-shared', please read /Users/soonersoft/.rvm/log/1612806268_ruby-3.0.0/configure.log There
> has been an error while running configure. Halting the installation.
> Gemset '' does not exist, 'rvm ruby-3.0.0 do rvm gemset create '
> first, or append '--create'.

有没有人遇到过同样的错误?如果是这样,你是如何解决这个问题的?

【问题讨论】:

  • 您的答案看起来像是隐藏在输出中,但看起来可能非常令人费解和疯狂。尝试运行rvm use ruby --install --default --create - 为了使用该版本的 ruby​​,您需要安装 3.0 gemset,但目前不存在。另一种方法是rvm install 3.0,然后运行rvm use 3.0 --default

标签: ruby-on-rails ruby macos gcc


【解决方案1】:

您需要在命令中添加--create 标志。成为:

rvm use ruby --install --default --create

【讨论】:

    【解决方案2】:

    常见的步骤如下:

    ruby -v                         # To Check the current ruby version (if installed)
    rvm install ruby-X.X.X          # To Install a specific ruby version
    rvm list                        # To List the existing ruby versions                                    
    rvm use ruby-X.X.X              # To Choose a version to use from the list ☝︎
    rvm use ruby-X.X.X --default    # To Set a version as default
    

    而且,正如@Tarek N. Elsamni 所说:

    rvm use ruby --install --default --create   # To create default gemset for Rails (visible in the last line of your error message)
    

    您始终可以在安装前后运行rvm list,因为它可以让您更好地了解您已安装的所有 ruby​​ 版本。

    ↳ 输出示例:

    DRG@GALVEZWEB current_project % rvm list     
    
           ruby-2.6.6 [ x86_64 ]
           ruby-2.7.1 [ x86_64 ]
        =* ruby-3.0.0 [ x86_64 ]
    
        # => - current
        # =* - current && default
        #  * - default
    

    【讨论】:

      猜你喜欢
      • 2022-06-23
      • 2017-08-18
      • 2013-09-27
      • 2012-02-07
      • 1970-01-01
      • 1970-01-01
      • 2016-07-29
      • 2012-07-23
      • 2015-03-31
      相关资源
      最近更新 更多