简体   繁体   中英

Rails server 'require' cannot load such file

I decided to start learning ruby/rails and went to install it on one of my windows machines via RubyInstaller. I got 2.2.0 installed, got the DevKit installed, ran gem install rails , and that worked.

Then I made a new project rails new project and created the folder and ran bundle install inside it. However, when going into the project folder and running rails server I get a the following error:

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>'

I initially tried following another question on SO and tried rake db:create but got a similar error for SQLite. In another question they suggested changing s.required_path from ['lib'] to ['lib/sqlite3_native'] or similar, and that fixed the error for SQLite, but not the others. It will be impractical, and impossible for me, to go through each gem config and fix this.

What is the best way to correct the paths for these gems?

As mentioned in this sqlite GitHub issue , it looks like there is no support for the particular version of Ruby that you are using. This seems to be a problem specifically on the Windows platform. Perhaps you should downgrade the Ruby version for now if you really can't change any of the other environmental variables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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