尝试创建模型时Rails错误

时间:2015-03-11 00:12:27

标签: ruby-on-rails ruby ruby-on-rails-4 devise gem

我是Ruby on Rails的新手,我遇到了一些麻烦。目前,我正在关注开始RoR应用程序开发的视频指导课程。

我在Windows 7,Ruby 2.2和Rails 4.2上使用Aptana Studio 3。 x64机器和Windows,但32位Ruby和DevKit安装。我通过在CLI中键入gem install rails来安装Rails。

我似乎无法创建基本模型,因为它会在尝试命令rails g model Company后导致错误,如下所示:

C:/Ruby22/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require: cannot load such file -- sqlite3/sqlite3_native (LoadError)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in block in require
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in load_dependency
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x86-mingw32/lib/sqlite3.rb:6:in rescue in <top (required)>
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x86-mingw32/lib/sqlite3.rb:2:in <top (required)>
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:76:in require
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:76:in block (2 levels) in require
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:72:in each
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:72:in block in require
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:61:in each
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler/runtime.rb:61:in require
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.8.4/lib/bundler.rb:134:in require
from C:/Ruby22/timetracker/config/application.rb:7:in <top (required)>
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:141:in require
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:141:in require_application_and_environment!
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:128:in generate_or_destroy
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:50:in generate
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in run_command!
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in <top (required)>
from bin/rails:4:in require
from bin/rails:4:in <main>`

我做了一些谷歌搜索,并且看到很多人,编辑sqlite3 gemspec文件中的s.require_paths值就行了,所以我尝试了。我将值从s.require_paths = ["lib"]更改为s.require_paths = ["lib/sqlite3_native"]。这似乎解决了一个问题并提出了另一个问题。 现在,当尝试运行相同的模型创建命令时,我得到一个不同的错误:

C:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.1.1/lib/web_console/railtie.rb:32:in block in <class:Railtie>: uninitialized constant WebConsole::Railtie::Middleware (NameError)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in instance_exec
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in run
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in block in run_initializers
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:226:in block in tsort_each
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:348:in block (2 levels) in each_strongly_connected_component
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:429:in each_strongly_connected_component_from
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:347:in block in each_strongly_connected_component
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:345:in each
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:345:in call
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:345:in each_strongly_connected_component
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:224:in tsort_each
from C:/Ruby22/lib/ruby/2.2.0/tsort.rb:203:in tsort_each
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in run_initializers
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:352:in initialize!
from C:/Ruby22/timetracker/config/environment.rb:5:in <top (required)>
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:328:in require_environment!
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:142:in require_application_and_environment!
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:128:in generate_or_destroy
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:50:in generate
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in run_command!
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in <top (required)>
from bin/rails:4:in require
from bin/rails:4:in <main>

我在Gemfile中默认生成的内容之外使用的gem如下:

gem devise
gem will_paginate
gem thin

当然,gem名称在我的实际文件中有单引号,但由于此站点的格式化,我删除了它们。 在进行了大量的搜索之后,似乎特定的错误可能意味着许多事情,而且我对Ruby的调试有点太新了,不知道下一步该看什么。

任何帮助确定这里真正的罪魁祸首,或任何有关尝试什么的建议都将得到真诚的赞赏。

如果需要任何其他技术细节,请询问,我会在此处上传信息。

提前致谢!

0 个答案:

没有答案
相关问题