在Ubuntu中全新安装RVM不让我安装gems(zlib错误)

时间:2022-10-09 18:39:08

Ok, I just created a fresh Ubuntu 11.04 install on Windows 7 using VirtualBox (not sure if this matters or not but just an fyi)

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

listing my rubies I get:

列出我的红宝石我得到:

aaron@aaron-VirtualBox:~$ rvm list

rvm rubies

=> ruby-1.9.2-p290 [ x86_64 ]

but then trying to install the rails gem I get this:

但后来尝试安装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:~$ 

What am I doing wrong?

我究竟做错了什么?

Edit:
After doing what Dylan said my output (to prove those libraries are now installed):

编辑:在做了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:~$

3 个解决方案

#1


25  

Run rvm notes and make sure to use apt-get to install the things RVM tells you to. It (something along the lines of zlib1g-devel will be one of them).

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

For Ubuntu, it should be something like this:

对于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

/ 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

You might have to recompile your 1.9.2 afterwards (not 100% sure of that).

您可能必须在之后重新编译1.9.2(不是100%确定)。

#2


19  

I found that we need to install package zlib after installing above packages(that rvm said). So we need to do:
rvm pkg install zlib
After that, re-install ruby. rvm reinstall 1.9.3
Run gem install rails
It will successfully install rails.

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

#3


0  

If you trust RVM you can run the following two commands. This

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

rvm requirements run
rvm reinstall all --force

Then the gem install rails command should work.

然后gem install rails命令应该可以工作。

The first step will install all the packages that are needed for RVM. You do not normally need all, but it beats trying to search package by package.

第一步将安装RVM所需的所有软件包。你通常不需要所有,但它试图逐包搜索。

Most people miss this part of the RVM install

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

Finally, see if there are any dependency requirements for your operating system by running:

最后,通过运行以下命令查看操作系统是否存在任何依赖性要求:

user$ rvm requirements

用户$ rvm要求

#1


25  

Run rvm notes and make sure to use apt-get to install the things RVM tells you to. It (something along the lines of zlib1g-devel will be one of them).

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

For Ubuntu, it should be something like this:

对于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

/ 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

You might have to recompile your 1.9.2 afterwards (not 100% sure of that).

您可能必须在之后重新编译1.9.2(不是100%确定)。

#2


19  

I found that we need to install package zlib after installing above packages(that rvm said). So we need to do:
rvm pkg install zlib
After that, re-install ruby. rvm reinstall 1.9.3
Run gem install rails
It will successfully install rails.

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

#3


0  

If you trust RVM you can run the following two commands. This

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

rvm requirements run
rvm reinstall all --force

Then the gem install rails command should work.

然后gem install rails命令应该可以工作。

The first step will install all the packages that are needed for RVM. You do not normally need all, but it beats trying to search package by package.

第一步将安装RVM所需的所有软件包。你通常不需要所有,但它试图逐包搜索。

Most people miss this part of the RVM install

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

Finally, see if there are any dependency requirements for your operating system by running:

最后,通过运行以下命令查看操作系统是否存在任何依赖性要求:

user$ rvm requirements

用户$ rvm要求