RoR:执行rake命令时出错db:create =>耙子流产了!没有这样的文件加载 - 初始化程序

时间:2010-09-09 08:27:46

标签: ruby-on-rails-3 rake

我刚刚安装了新版本的Ubuntu 10.04,并希望让我的rails项目正常运行。我检查了rails项目2.3.3并使用典型的sqlite设置填写databasye.yml文件:

# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
  adapter: sqlite3
  database: db/pictrs_development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/pictrs_test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/pictrs_production.sqlite3
  pool: 5
  timeout: 5000

当我跑步时:

rake db:create

我收到以下错误:

helex@mg:~/Downloads/pictrs_on_rails$ rake db:migrate
(in /home/helex/Downloads/pictrs_on_rails)
rake aborted!
no such file to load -- initializer
/home/helex/Downloads/pictrs_on_rails/Rakefile:4:in `require'
(See full trace by running task with --trace)

rake db:create --trace的输出是:

rake aborted!
no such file to load -- initializer
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/home/helex/Downloads/pictrs_on_rails/config/boot.rb:55:in `load_initializer'
/home/helex/Downloads/pictrs_on_rails/config/boot.rb:38:in `run'
/home/helex/Downloads/pictrs_on_rails/config/boot.rb:11:in `boot!'
/home/helex/Downloads/pictrs_on_rails/config/boot.rb:110
/home/helex/Downloads/pictrs_on_rails/Rakefile:4:in `require'
/home/helex/Downloads/pictrs_on_rails/Rakefile:4
/usr/lib/ruby/1.8/rake.rb:2383:in `load'
/usr/lib/ruby/1.8/rake.rb:2383:in `raw_load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2017:in `load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2016:in `load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2000:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:28

rake似乎在加载Rakefile的以下行时出现问题:

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

我在ubuntu 9.10下设置了同一个项目,并且在执行rake任务时收到了错误消息,该任务告诉我为项目安装特定的gem,因此很容易修复。我创建其他新项目,他们都工作。其实我不知道在哪里寻找错误。我使用了不同的rubygems版本并尝试了google-search中的各种内容。

这是我的宝石列表:

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0)
actionpack (3.0.0)
activemodel (3.0.0)
activerecord (3.0.0)
activeresource (3.0.0)
activesupport (3.0.0)
arel (1.0.1)
authlogic (2.1.6)
aws-s3 (0.6.2)
barby (0.4.0)
builder (2.1.2)
bundler (1.0.0)
columnize (0.3.1)
configuration (1.1.0)
daemons (1.1.0)
erubis (2.6.6)
fastthread (1.0.7)
gravatar (1.0)
haml (3.0.18)
heroku (1.10.0)
i18n (0.4.1)
json_pure (1.4.6)
launchy (0.3.7)
libxml-ruby (1.1.4)
linecache (0.43)
log4r (1.1.8)
macaddr (1.0.0)
mail (2.2.5)
memcache-client (1.8.5)
mime-types (1.16)
money (3.0.5)
mysql (2.8.1)
pg (0.9.0)
polyglot (0.3.1)
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)
prawnto (0.0.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.4)
rails (3.0.0)
railties (3.0.0)
rake (0.8.7)
rest-client (1.6.1, 1.4.2)
rmagick (2.13.1)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.10)
rubygems-update (1.3.7)
rubyzip (0.9.4)
sqlite3-ruby (1.3.1)
stateless-systems-paypal (2.1.3)
SystemTimer (1.2)
test-unit (2.1.1)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.14.0)
treetop (1.4.8)
tzinfo (0.3.23)
uuid (2.3.1)
xml-simple (1.0.12)
ya2yaml (0.30)

我已经在我的意见中安装了所有需要的宝石。您能否提出一些新的想法来考虑如何解决这个问题?

非常感谢你的时间。

1 个答案:

答案 0 :(得分:2)

您已安装Rails 3.0,但您正在尝试运行Rails 2.3.3项目。尝试安装与您的项目匹配的Rails版本,您可能会没事的。