繁体   English   中英

Rails服务器“需要”无法加载此类文件

[英]Rails server 'require' cannot load such file

我决定开始学习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配置并修复它是不切实际的,也是不可能的。

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

如在此sqlite GitHub问题中所述 ,似乎不支持您正在使用的特定版本的Ruby。 这似乎是Windows平台上特别存在的问题。 如果您确实无法更改任何其他环境变量,则也许现在应该降级Ruby版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM