Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
940 views
in Technique[技术] by (71.8m points)

ruby on rails - cannot load such file — sqlite3/sqlite3_native

When I want to run rails server for my app it shows following error. I need help to identifies where the error

C:Sitesapp1>rails s
Traceback (most recent call last):
    22: from bin/rails:4:in `<main>'
    21: from bin/rails:4:in `require'
    20: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.5/lib/rails/commands.rb:16:in `<top (required)>'
    19: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.5/lib/rails/command.rb:44:in `invoke'
    18: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.5/lib/rails/command/base.rb:63:in `perform'
    17: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
    16: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
    15: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
    14: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.5/lib/rails/commands/server/server_command.rb:130:in `perform'
    13: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.5/lib/rails/commands/server/server_command.rb:130:in `tap'
    12: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.5/lib/rails/commands/server/server_command.rb:133:in `block in perform'
    11: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.5/lib/rails/commands/server/server_command.rb:133:in `require'
    10: from C:/Sites/app1/config/application.rb:7:in `<top (required)>'
     9: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/bundler.rb:114:in `require'
     8: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:65:in `require'
     7: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:65:in `each'
     6: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:76:in `block in require'
     5: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:76:in `each'
     4: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:81:in `block (2 levels) in require'
     3: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:81:in `require'
     2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
     1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13-x64-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13-x64-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Make sure your gems are installed correctly and using correct versions of sqlite. Check you have this in your Gemfile:

gem 'sqlite3',  '~> 1.3.11'

Then from root of your project run

bundle install

You may also need to run this if you have not already.

rails db:create db:migrate #this is for rails >= 5

or

rake db:create db:migrate  #rails <= 4.2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...