2011-11-16 110 views
2

我正在使用Michael Hartl的「ruby on rails by example tutorial」(screencasts),我在第三課(示例應用程序)中嘗試執行「軟件包安裝」 。「軟件包安裝」錯誤

我按照教程中所示更改了Gemfile,如網站(更新的)所示,甚至嘗試了本教程的最終Gemfile。每當我遇到不能安裝的錯誤時,軟件包安裝將無法繼續。

起初它說'nokogiri',然後'json',現在'bcrypt'。這並沒有發生,當我做了第一個應用程序和演示應用程序。也許是因爲我現在嘗試添加rspec?我不想在沒有將它添加到Gemfile的情況下繼續教程,因爲它聽起來很重要。

我正在運行osx lion 10.7.2,rails版本3.0.1。

複製從評論的Gemfile代碼到原帖:

source 'rubygems.org'; 

gem 'rails', '3.0.1' 
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' 

group :development do 
    gem 'rspec-rails', '2.0.0.beta.18' 
end 

group :test do 
    gem 'rspec', '2.0.0.beta.18' 
end 

更新:我從別人聽到RSpec的是測試使用的寶石,所以你不能讓Rails項目沒有默認測試然後更改gemfile。那麼爲什麼在教程中他做了一個「rails new sample_app -T」,但後綴改變了Gemfile,所以它使用rspec?他說,他們取代對方。該rspec替換原始測試,因此您需要在沒有原始測試的情況下創建一個項目。對此有何想法?

+0

後一些代碼(即你的Gemfile)和你得到的錯誤。沒有更多的信息,很難理解這個問題。 – pasine

+0

沒有錯誤,您將無法獲得幫助 - 我們無法看到您的終端! –

+0

source'rubygems.org'; gem'rails','3.0.1'gem'sqlite3-ruby','1.2.5',:require =>'sqlite3'group:development gem'rspec-rails','2.0.0.beta.18' end group:測試做gem'rspec','2.0.0.beta.18'end ^這是Gemfile代碼。綁定時出現錯誤:「安裝nokogiri(1.5.0)時發生錯誤,Bundler無法繼續。確保gem install nokogiri -v'1.5.0'在捆綁之前成功」。我以前安裝過nokogiri。那麼爲什麼會這樣呢? –

回答

0

我把這個錯誤擰了幾個小時,然後檢查了rspec github頁面。根據他們的指示,你需要包含github的路徑。所以,我提出通過的Gemfile看起來像下面的,現在可:

group :development do 
    gem "rspec-rails",  :git => "git://github.com/rspec/rspec-rails.git" 
    gem "rspec",    :git => "git://github.com/rspec/rspec.git" 
    gem "rspec-core",   :git => "git://github.com/rspec/rspec-core.git" 
    gem "rspec-expectations", :git => "git://github.com/rspec/rspec-expectations.git" 
    gem "rspec-mocks",  :git => "git://github.com/rspec/rspec-mocks.git" 
end 

group :test do 
    gem "rspec-rails",  :git => "git://github.com/rspec/rspec-rails.git" 
    gem "rspec",    :git => "git://github.com/rspec/rspec.git" 
    gem "rspec-core",   :git => "git://github.com/rspec/rspec-core.git" 
    gem "rspec-expectations", :git => "git://github.com/rspec/rspec-expectations.git" 
    gem "rspec-mocks",  :git => "git://github.com/rspec/rspec-mocks.git" 
    gem 'webrat' 
end 

我使用Ruby 1.9.3,Rails的3.2.1,RVM 1.10.2,捆紮機1.0.21