我只是想学习Rspec。为此,我不得不用ubuntu linux 14.10创建一个VM。我安装了RVM并默认为1.9.3。现在,我正在尝试使用gem - Bundler安装以下gem。我也可以使用gem install
命令安装每个gem。但是,我想使用Bundler,因为它组织得很好。
Q1 - 通过Bundler进行的所有安装是通过RVM还是绕过它们? 如果是,那么我必须手动完成。
这是我的文件名为Gemlock -
source 'http://rubygems.org'
# gem 'ruby','1.8.7'
gem 'rubygems', '1.3.7'
gem 'rspec', '2.0.0'
gem 'rspec-rails', '2.0.0'
gem 'cucumber', '0.9.2'
gem 'cucumber-rails', '0.3.2'
gem 'database_cleaner', '0.5.2'
gem 'webrat', '0.7.2'
gem 'selenium-client', '1.2.18'
gem 'rails', '3.0.0'
以下是各种捆绑安装的输出 -
john@ubuntu:~/Code/Rspec$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Resolving dependencies...
Could not find gem 'rubygems (= 1.3.7) ruby' in the gems available on this machine.
john@ubuntu:~/Code/Rspec$ bundle install --full-index
Fetching source index from https://rubygems.org/
Resolving dependencies...
Could not find gem 'rubygems (= 1.3.7) ruby' in the gems available on this machine.
john@ubuntu:~/Code/Rspec$ bundle install --full-index
Fetching source index from http://rubygems.org/
Resolving dependencies...
Could not find gem 'rubygems (= 1.3.7) ruby' in the gems available on this machine.
john@ubuntu:~/Code/Rspec$
我在Stack溢出时看到一些帖子告诉我在gemsource中使用http而不是https。失败了!我也试过了bundle install --full-index
。失败。
Q2 - 此错误的含义是什么 - 此系统上没有rubygems 1.3.7?这就是我试图安装它的原因!
请帮我解决这个问题。
当我尝试手动安装rubygems 1.3.7时,我得到了 -
john@ubuntu:~/Code/Rspec$ gem install rubygems -v 1.3.7
ERROR: Could not find a valid gem 'rubygems' (= 1.3.7) in any repository
ERROR: Possible alternatives: ruby_gem, rubydeps, ruby-rets, rubyless, rubyjams
更新
我在我的捆绑代码中评论了rubygems行并得到了错误 -
john@ubuntu:~/Code/Rspec$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.7.9)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
john@ubuntu:~/Code/Rspec$
答案 0 :(得分:1)
从Gemfile中删除gem 'rubygems'
行。没有必要这样做。