2010-11-15 65 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/

当然你需要适当的路径。