好的,我正在尝试跟随Rails in Action 4一书。
目前正在第3章
这就是Gemfile应该是什么:
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'sqlite3'
group :assets do
gem 'sprockets-rails', '~> 2.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.0.1'
group :test, :development do
gem 'rspec-rails', "~> 2.12"
end
group :test do
gem 'capybara', "2.0.2"
end
这是我第一次处理rails 4和ruby 2.
当我尝试运行bundle update
时,我明白了:
Could not find gem 'rails (= 4.0.0) ruby' in the gems available on this machine.
我拥有的rails版本是:Rails 4.0.0.rc1
如果您查看此页面:http://rubygems.org/gems/rails,它们似乎没有Rails 4.0.0
我无法解决这种情况。
每当我尝试更改gem 'rails', '4.0.0.rc1
时,我都会明白:
Bundler could not find compatible versions for gem "sprockets-rails":
In Gemfile:
sprockets-rails (~> 2.0.0) ruby
rails (= 4.0.0.rc1) ruby depends on
sprockets-rails (2.0.0.rc4)
现在最奇怪的是我的笔记本电脑现在说它没有轨道了!每当我尝试运行它的版本时,它会说:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
但我没有对RVM做任何事情或改变rails,或其他任何东西!
完全莫名其妙!
答案 0 :(得分:1)
您正在使用本书的预发行版本,该版本的编写是为了预测图书启动后的宝石版本。试试这个
source 'https://rubygems.org'
gem 'rails', '4.0.0.rc1'
gem 'sqlite3'
group :assets do
gem 'sprockets-rails', '~> 2.0.0.rc4'
gem 'sass-rails', '~> 4.0.0.rc1'
gem 'coffee-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.0.1'
group :test, :development do
gem 'rspec-rails', "~> 2.12"
end
group :test do
gem 'capybara', "2.0.2"
end