Railscast上的说明,但无法启动服务器。它声明了以下错误:
$ 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没有引用任何rails 2.x版本,在“bundle install”结果中我得到了结果:“使用rails(3.0.1)”< / p>
编辑:(添加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 :(得分:2)
我遇到了同样的问题。
我修复它只是删除Gemfile.lock文件并从控制台运行
bundle install
如果您也遇到Bundler问题,可以再次安装
gem install bundler # you may need sudo before.
这对我有用。
答案 1 :(得分:0)
export GEM_HOME=/usr/lib/ruby1.9.1/gems/1.9.1/
当然,你需要适当的路径。