RoR:执行 rake 命令 db:create => 时出错耙子中止!没有要加载的文件——初始化程序

发布于 2024-09-18 12:47:08 字数 3682 浏览 2 评论 0原文

我刚刚安装了全新版本的 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,因此很容易修复。我创建了其他新项目,它们都有效。其实我不知道在哪里寻找错误。我使用了不同的 ruby​​gems 版本,并尝试了谷歌搜索中的各种内容。

这是我的宝石列表:

*** 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)

我已经安装了我认为所有需要的宝石。您能否提供一些新的东西来思考如何解决这个问题?

非常感谢您抽出时间。

I just installed a fresh new version of Ubuntu 10.04 and wanted to get my rails projects working. I checked out a rails project 2.3.3 and fill in the databasye.yml file with the typical sqlite-settings:

# 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

When I run:

rake db:create

I get the following error:

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)

The output of rake db:create --trace is:

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 seems to have problems with loading the following line of the Rakefile:

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

I set up the same project under ubuntu 9.10 and I got error-messages when doing a rake task which told me to install specific gems for the project and so this was easy to fix. I create other fresh projects and they all worked. Actually I don't know where to look for the error. I used different rubygems versions and tryed various things out of my google-search.

Here my gem-list:

*** 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)

I have installed, in my opinio all needed gems. Can you just give some new things to think about how to fix this issue?

Thanks a lot for your time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落墨 2024-09-25 12:47:09

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

You have Rails 3.0 installed, but you're trying to run a Rails 2.3.3 project. Try installing a Rails version that matches your project and you'll probably be fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文