【问题标题】:Fresh install of RVM in Ubuntu isn't letting me install gems (zlib error)在 Ubuntu 中全新安装 RVM 不允许我安装 gems(zlib 错误)
【发布时间】:2011-08-03 00:58:16
【问题描述】:

好的,我刚刚使用 VirtualBox 在 Windows 7 上创建了一个全新的 Ubuntu 11.04 安装(不确定这是否重要,仅供参考)

列出我得到的红宝石:

aaron@aaron-VirtualBox:~$ rvm list

rvm rubies

=> ruby-1.9.2-p290 [ x86_64 ]

然后尝试安装 rails gem 我得到了这个:

aaron@aaron-VirtualBox:~$ gem install rails
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand
aaron@aaron-VirtualBox:~$ 

我做错了什么?

编辑:
在完成 Dylan 所说的输出之后(证明这些库现在已安装):

aaron@aaron-VirtualBox:~$ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
[sudo] password for aaron: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
autoconf is already the newest version.
bison is already the newest version.
build-essential is already the newest version.
git-core is already the newest version.
libc6-dev is already the newest version.
libncurses5-dev is already the newest version.
libreadline6 is already the newest version.
libreadline6-dev is already the newest version.
libsqlite3-0 is already the newest version.
libsqlite3-dev is already the newest version.
libssl-dev is already the newest version.
libxslt1-dev is already the newest version.
libyaml-dev is already the newest version.
openssl is already the newest version.
sqlite3 is already the newest version.
zlib1g is already the newest version.
zlib1g-dev is already the newest version.
curl is already the newest version.
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
aaron@aaron-VirtualBox:~$ gem install rails
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand
aaron@aaron-VirtualBox:~$

【问题讨论】:

    标签: ruby ubuntu gem rvm


    【解决方案1】:

    运行rvm notes 并确保使用apt-get 来安装RVM 告诉你的东西。它(类似于zlib1g-devel 的东西就是其中之一)。

    对于 Ubuntu,应该是这样的:

    /usr/bin/apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev

    之后您可能需要重新编译您的 1.9.2(不是 100% 肯定)。

    【讨论】:

    • Dylan,起初它不起作用,但后来我读了最后一部分:D。我不得不重新编译。现在可以了!
    • 在我运行 sudo apt-get install libxml2-dev libxslt-dev 之前,我无法让 gem install 做任何事情。不需要重新编译;之后它才开始工作。谢谢。
    【解决方案2】:

    我发现我们需要在安装上述包之后安装包zlib(即rvm所说)。 所以我们需要这样做:
    rvm pkg install zlib
    之后,重新安装 ruby​​。 rvm reinstall 1.9.3
    gem install rails
    它将成功安装rails。

    【讨论】:

    • 非常好的解决方案。太棒了!
    • 也为我工作!谢谢。
    • 我也是!谢谢!比 apt-get 其他一切都快得多
    【解决方案3】:

    如果您信任 RVM,您可以运行以下两个命令。这个

    rvm requirements run
    rvm reinstall all --force
    

    那么 gem install rails 命令应该可以工作了。

    第一步将安装 RVM 所需的所有软件包。您通常不需要全部,但它比尝试逐个包搜索要好。

    大多数人都错过了 RVM 安装的这一部分

    最后,看看你是否有任何依赖要求 通过运行操作系统:

    user$ rvm 要求

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多