2016-08-03 65 views
0

右鍵Rails服務器時啓動rails server命令紅寶石終端不啓動服務器後,並寫入以下內容:錯誤在Windows上啓動

C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError) 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `require' 
    from C:/Sites/testing/config/application.rb:7:in `<top (required)>' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `require' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88:in `block in server' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!' 
    from C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

當尋找答案類似的問題,我還沒有找到任何工作解。我可以這樣說:

  1. 應用程序在目錄中創建,其中路徑只有英文符號。
  2. 我試圖用解決問題: gem cleanup bundle install
  3. 我試着使用啓動服務器:bundle exec rails server
  4. 我試圖刪除gemfile中包含「問題」的寶石。
  5. 還嘗試完全重新安裝Ruby和Rails的所有寶石。

這一切都沒有幫助,所以我會非常感謝在我的案例解決方案中工作!

P.S.我正在研究:Windows 8.1(64位),Ruby 2.3.0,Rails 5.0.0

+0

可能重複的[無法加載這樣的文件 - sqlite3/sqlite3的_native(LoadError)在軌道上的紅寶石](http://stackoverflow.com/questions/17643897/cannot-load-such-file-sqlite3-sqlite3 -native-loaderror-on-ruby-on-rails) –

回答

1

找到您的sqlite3 gemspec文件。一個例子是

`/usr/local/share`/gem/specifications/sqlite3-1.3.7.gemspec` 

的Windows:C:\Ruby21\lib\ruby\gems\2.1.0\specifications.

您應該與Rubygem路徑和sqlite3的版本根據調整。編輯上述文件並查找以下行

s.require_paths=["lib"] 

改變它

s.require_paths= ["lib/sqlite3_native"] 

希望幫助!

+0

不幸的是,這也沒有奏效。我嘗試了你的解決方案,服務器正常啓動,但它的主頁(例如localhost:3000)表示如下: 「無法加載'active_record/connection_adapters/sqlite3_adapter'。確保config/database.yml中的適配器有效。你使用'mysql','mysql2','postgresql'或'sqlite3'以外的適配器將必要的適配器gem添加到Gemfile中。「 – mishako

+0

確保你的Gemfile中有gem'sqlite3'。 –