Rails服务器'require'无法加载此类文件

时间:2015-08-10 05:14:15

标签: ruby-on-rails ruby

我决定开始学习ruby / rails并通过RubyInstaller在我的一台Windows机器上安装它。我安装了2.2.0,安装了DevKit,运行了gem install rails,这很有效。

然后我创建了一个新项目rails new project并创建了该文件夹并在其中运行bundle install。但是,当进入项目文件夹并运行rails server时,我收到以下错误:

C:/Ruby22/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x86-mingw32/lib/sqlite3.rb:6:i
n `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x86-mingw32/lib/s
qlite3.rb:6:in `rescue in <top (required)>'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x86-mingw32/lib/s
qlite3.rb:2:in `<top (required)>'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runti
me.rb:76:in `require'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runti
me.rb:76:in `block (2 levels) in require'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runti
me.rb:72:in `each'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runti
me.rb:72:in `block in require'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runti
me.rb:61:in `each'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runti
me.rb:61:in `require'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:13
4:in `require'
        from C:/Users/Jeff/Documents/GameDB/config/application.rb:7:in `<top (re
quired)>'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/command
s/commands_tasks.rb:78:in `require'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/command
s/commands_tasks.rb:78:in `block in server'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/command
s/commands_tasks.rb:75:in `tap'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/command
s/commands_tasks.rb:75:in `server'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/command
s/commands_tasks.rb:39:in `run_command!'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/command
s.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

我最初尝试在SO上关注另一个问题并尝试rake db:create但是SQLite也遇到了类似的错误。在另一个问题中,他们建议将s.required_pa​​th从['lib']更改为['lib/sqlite3_native']或类似,并修复SQLite的错误,但不修复其他错误。对我来说,通过每个gem配置并修复它是不切实际的,也是不可能的。

纠正这些宝石的路径的最佳方法是什么?

1 个答案:

答案 0 :(得分:1)

正如本sqlite GitHub issue中所提到的,看起来似乎不支持您正在使用的特定版本的Ruby。这似乎是Windows平台上的一个问题。如果您真的无法更改任何其他环境变量,也许您现在应该降级Ruby版本。

相关问题