在 Ubuntu 中全新安装 RVM 不允许我安装 gem(zlib 错误)



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

列出我得到的红宝石:

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:~$

运行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%确定)。

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

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

rvm requirements run
rvm reinstall all --force

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

第一步将安装RVM所需的所有软件包。你通常不需要所有的,但是它比一个包一个包地搜索要好。

大多数人忽略了RVM安装的这一部分

最后,看看是否有任何依赖于您的操作系统:

user$ RVM requirements

最新更新