2010-11-15 63 views
3

請按照Railscast的說明進行操作,但無法啓動服務器。它指出了以下錯誤:3.0.1升級後無法啓動Rails服務器

$ rails s 
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)` 
from script/rails:6:in `<main>' 

望見this related question的答案,但我的Gemfile沒有提及任何防護欄2.x版,並在「包安裝」結果我的成績得到這樣的:「使用Rails( 3.0.1)」

編輯:(添加Gemfile.lock的詳情)

GEM 
    remote: http://rubygems.org/ 
    specs: 
    abstract (1.0.0) 
    actionmailer (3.0.1) 
     actionpack (= 3.0.1) 
     mail (~> 2.2.5) 
    actionpack (3.0.1) 
     activemodel (= 3.0.1) 
     activesupport (= 3.0.1) 
     builder (~> 2.1.2) 
     erubis (~> 2.6.6) 
     i18n (~> 0.4.1) 
     rack (~> 1.2.1) 
     rack-mount (~> 0.6.12) 
     rack-test (~> 0.5.4) 
     tzinfo (~> 0.3.23) 
    activemodel (3.0.1) 
     activesupport (= 3.0.1) 
     builder (~> 2.1.2) 
     i18n (~> 0.4.1) 
    activerecord (3.0.1) 
     activemodel (= 3.0.1) 
     activesupport (= 3.0.1) 
     arel (~> 1.0.0) 
     tzinfo (~> 0.3.23) 
    activeresource (3.0.1) 
     activemodel (= 3.0.1) 
     activesupport (= 3.0.1) 
    activesupport (3.0.1) 
    arel (1.0.1) 
     activesupport (~> 3.0.0) 
    builder (2.1.2) 
    calendar_date_select (1.16.1) 
    erubis (2.6.6) 
     abstract (>= 1.0.0) 
    googlecharts (1.6.0) 
    i18n (0.4.2) 
    mail (2.2.9) 
     activesupport (>= 2.3.6) 
     i18n (~> 0.4.1) 
     mime-types (~> 1.16) 
     treetop (~> 1.4.8) 
    mechanize (1.0.0) 
     nokogiri (>= 1.2.1) 
    mime-types (1.16) 
    nokogiri (1.4.3.1) 
    pg (0.9.0) 
    polyglot (0.3.1) 
    rack (1.2.1) 
    rack-mount (0.6.13) 
     rack (>= 1.0.0) 
    rack-test (0.5.6) 
     rack (>= 1.0) 
    rails (3.0.1) 
     actionmailer (= 3.0.1) 
     actionpack (= 3.0.1) 
     activerecord (= 3.0.1) 
     activeresource (= 3.0.1) 
     activesupport (= 3.0.1) 
     bundler (~> 1.0.0) 
     railties (= 3.0.1) 
    railties (3.0.1) 
     actionpack (= 3.0.1) 
     activesupport (= 3.0.1) 
     rake (>= 0.8.4) 
     thor (~> 0.14.0) 
    rake (0.8.7) 
    sparklines (0.5.2) 
    thor (0.14.4) 
    treetop (1.4.8) 
     polyglot (>= 0.3.1) 
    tzinfo (0.3.23) 

PLATFORMS 
    ruby 

DEPENDENCIES 
    calendar_date_select 
    googlecharts 
    mechanize 
    pg 
    rails (= 3.0.1) 
    sparklines 

編輯:(添加的boot.rb詳情)

require 'rubygems' 

# Set up gems listed in the Gemfile. 
gemfile = File.expand_path('../../Gemfile', __FILE__) 
begin 
    ENV['BUNDLE_GEMFILE'] = gemfile 
    require 'bundler' 
    Bundler.setup 
rescue Bundler::GemNotFound => e 
    STDERR.puts e.message 
    STDERR.puts "Try running `bundle install`." 
    exit! 
end if File.exist?(gemfile) 
+0

Gemfile.lock顯示什麼? – johnmcaliley 2010-11-15 01:50:35

+0

我已經將文件包含在原文中。 – Alberto 2010-11-15 01:53:38

+0

對我來說很不錯。那麼script/rails需要的文件如application.rb呢?你應該有一個expand_path引導,一個'rails/all'的需求並且調用Bundler.require。那裏面都有嗎? – johnmcaliley 2010-11-15 02:01:33

回答

2

我有同樣的問題。

我固定它只是刪除Gemfile.lock的文件,並從控制檯

bundle install 

如果你有問題,捆紮機,以及運行,你可以重新安裝

gem install bundler # you may need sudo before. 

,使它爲我工作。

0

export GEM_HOME=/usr/lib/ruby1.9.1/gems/1.9.1/

當然你需要適當的路徑。