好的,我刚刚在Windows 7上使用VirtualBox创建了一个全新的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:~$
答案 0 :(得分:25)
运行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%肯定)。
答案 1 :(得分:19)
我发现在安装上面的软件包之后我们需要安装软件包 zlib (rvm说)。
所以我们需要这样做:
rvm pkg install zlib
之后,重新安装ruby。
rvm reinstall 1.9.3
跑
gem install rails
它将成功安装rails。
答案 2 :(得分:0)
如果您信任RVM,则可以运行以下两个命令。这个
rvm requirements run
rvm reinstall all --force
然后gem install rails命令应该可以工作。
第一步将安装RVM所需的所有软件包。你通常不需要所有,但它试图逐包搜索。
大多数人都错过了RVM安装的这一部分
最后,看看您是否有任何依赖性要求 操作系统运行:
用户$ rvm要求