1

我刚刚开始使用 ruby​​ on rails,制作了一个新的 rails 项目文件夹。现在我正在尝试使用 rake db:create 命令,但出现以下错误。请帮忙。

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /home/samsung/ruby/blog/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /home/samsung/ruby/blog/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91.
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
    at /usr/lib/ruby/vendor_ruby/rake/rdoctask.rb
Please install RDoc 2.4.2+ to generate documentation.
rake aborted!
no such file to load -- sqlite3

Tasks: TOP => db:create
(See full trace by running task with --trace)
4

2 回答 2

1

错误出现在输出的最后一行:

no such file to load -- sqlite3

它表明它无法找到该sqlite3文件。这可能是因为sqlite3未安装 gem。尝试使用以下命令找到它:

gem list sqlite3

如果没有出现,请使用以下命令安装它:

gem install sqlite3

我想你可能也安装了旧版本的 Ruby。我建议使用 RVM 并安装更新版本的 Ruby,例如 1.9,而不是 1.8。有关如何执行此操作的信息,请参阅此页面。

于 2012-10-10T04:16:25.573 回答
1

您需要确保将要使用的 gem 添加到 gemfile 中:

gem 'sqlite3'

然后,从应用根目录中的命令行安装 gems:

bundle install

这将导致它们被自动需要,从而修复以下错误:

no such file to load -- sqlite3
于 2012-10-10T06:03:10.540 回答