Ubuntu12中的Capybara gem安装错误

时间:2013-07-25 06:34:07

标签: ruby-on-rails ruby gem rvm capybara

Iam尝试执行命令bundle install它显示错误消息

Gem::InstallError: capybara requires Ruby version >= 1.9.3.
An error occurred while installing capybara (2.1.0), and Bundler cannot continue.
Make sure that `gem install capybara -v '2.1.0'` succeeds before bundling.

所以我将ruby 1.8.2升级为ruby 1.9.3,并在rvm.

中将其设为默认值
$ rvm list
rvm rubies

=* ruby-1.9.3-p448 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

 $ ruby -v

我得到ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

执行bundle install时获得相同的错误。

因为使用rvm我使用命令gem install capybara -v '2.1.0' iam getting

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /var/lib/gems/1.9.1 directory

后来我尝试了sudo gem install capybara -v '2.1.0'

成功安装

所以我再次使用bundle install命令在我的gem文件中安装重新映射的gems,它显示了相同的上述错误。

Gem::InstallError: capybara requires Ruby version >= 1.9.3.
An error occurred while installing capybara (2.1.0), and Bundler cannot continue.
Make sure that `gem install capybara -v '2.1.0'` succeeds before bundling.

2 个答案:

答案 0 :(得分:1)

我建议您设置项目相关的rvm设置。 转到您的项目文件夹并执行以下操作:

echo "ruby-1.9.3-p448" > .ruby-version
echo "myapp" > .ruby-gemset

关闭控制台,重新打开它,然后再次转到项目文件夹。然后,验证ruby版本是 1.9.3-p448 ruby -v)并执行以下操作:

gem install bundler
bundle install

有关详细信息,请参阅此answer

答案 1 :(得分:0)

确保在尝试之前安装了这些......

sudo apt-get install libqt4-dev libqtwebkit-dev