ruby - 无法运行 "gem list"!

标签 ruby ubuntu rubygems zlib rvm

运行时出现错误:

vagrant@vagrantup:~$ sudo gem list
ERROR:  Loading command: list (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::ListCommand

即使我不使用 sudo,我也会收到相同的错误消息。

它在 Ubuntu 10.4 上,我已经安装了 zlib 库:

vagrant@vagrantup:~$ sudo aptitude search zlib
p   gambas2-gb-compress-bzlib2                                                    - The Gambas bzlib2 component                                                             
p   gambas2-gb-compress-zlib                                                      - The Gambas zlib compression component                                                   
p   haskell-zlib-doc                                                              - Compression and decompression in the gzip and zlib formats; documentation               
p   libcompress-raw-zlib-perl                                                     - low-level interface to zlib compression library                                         
p   libcompress-zlib-perl                                                         - Transitional dummy package for Compress::Zlib                                           
i   libghc6-zlib-dev                                                              - Compression and decompression in the gzip and zlib formats                              
v   libghc6-zlib-dev-0.5.2.0-d3bd7                                                -                                                                                         
v   libghc6-zlib-doc                                                              -                                                                                         
p   libghc6-zlib-prof                                                             - Compression and decompression in the gzip and zlib formats; profiling libraries         
v   libghc6-zlib-prof-0.5.2.0-d3bd7                                               -                                                                                         
p   libio-compress-zlib-perl                                                      - Transitional dummy package for IO::Compress::Zlib                                       
p   libio-zlib-perl                                                               - IO:: style interface to gzip/zlib compressed files/handles                              
p   libjzlib-java                                                                 - reimplementation of zlib in pure Java                                                   
i   libzlib-ruby                                                                  - transitional dummy package                                                              
v   libzlib-ruby1.8                                                               -                                                                                         
p   zlib-bin                                                                      - compression library - sample programs                                                   
i   zlib1g                                                                        - compression library - runtime                                                           
p   zlib1g-dbg                                                                    - compression library - development                                                       
i   zlib1g-dev                                                                    - compression library - development                                                       
i   zlibc                                                                         - An on-fly auto-uncompressing C library

我正在使用http://www.vagrantup.com我安装了rvm后出现错误。

问题可能是什么?

最佳答案

Ruby 是如何安装的?如果安装 Ruby 时没有 zlib 支持,那就会出现问题。

你可以阅读我的文章here在 Ubuntu 上安装 RVM。在编译 Ruby 之前,您必须安装 zlib 和 zlib-dev 软件包(以及 Ubuntu 中的一些其他软件包)。您可能只需要安装这些并重新编译 Ruby。

关于ruby - 无法运行 "gem list"!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3578592/

相关文章:

ruby - ActionDispatch::IntegrationTest 中的 stub 方法

ruby-on-rails - SQLite3::SQLException:在“CONSTRAINT”附近:语法错误

xml - 在 Ruby 中将 YAML 转换为 XML?

mysql - 在 Ubuntu 20.04 上安装 mysql2 gem 版本 '0.3.21' 时出错

ruby-on-rails - 打开 gem,使用 Rubymine

ruby-on-rails - Carrierwave - 未定义方法 `mount_uploaders'

ubuntu - 在 gitlab(也可能是 github)中运行 Flutter Web 集成测试 Ubuntu VM 因 Chromedriver 而失败

bash - 在 Windows 10 中从 bash/linux 子系统打开资源管理器

ubuntu - ProFTPd 无法设置 euid

linux - 找不到 'librarian-chef' (Gem::LoadError)