Error “no such file to load” — sqlite3/sqlite3_nat

2019-01-12 06:00发布

My OS is Windows 7.

My problem is that when I try to run rails server, an error occurs. I have installed the sqlite3 gem, even the sqlite-ruby gem, and still nothing.

I already don't know what to do anymore.

If anyone needs any additional information, ask for it and I'll put it up.

The complete error is:

C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.3-x86-mingw32/lib/sqlite3.rb:6:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.3-x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.3-x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `block in require'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
    from C:/Users/JorWan/Desktop/JorWan/ASCENDSTUDIO/RoR/intento2/config/application.rb:7:in `<top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/commands.rb:28:in `block in <top (required)>'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
    from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

5条回答
Animai°情兽
2楼-- · 2019-01-12 06:27

Is that file (/sqlite3/sqlite3_native) in your PATH environment variable? It will need to be in order for that gem to work. If you need to check try using echo %PATH% on the command prompt. If it ends up that you need to add it to your path you can either SET PATH=%PATH%;C:\Path\To\Sqlite3 or change your environment variables by selecting the Properties\Advances\Environment Variables option after right-clicking on My Computer. Edit the path variable to contain your path and viola!

查看更多
Lonely孤独者°
3楼-- · 2019-01-12 06:27

This URL provides the step-wise description and solution. Hope it works for you. http://rubyonwindowsguides.github.io/book/ch02-05.html

查看更多
ら.Afraid
4楼-- · 2019-01-12 06:31

download the required executable and the dll from http://www.sqlite.org/download.html extract to your ruby's bin (c:\Ruby192\bin)

查看更多
走好不送
5楼-- · 2019-01-12 06:39

Forget all the so called "answers", no compiling of the sources or downloading pre-compiled libraries will solve this problem, believe me I tried everything, the problem lies somewhere else. This is how it works on windows:

bundle update sqlite3

You likely get another similar error after this one regarding nokogiri, fix it with the command:

bundle update nokogiri

Enjoy your Ruby App!

查看更多
戒情不戒烟
6楼-- · 2019-01-12 06:44

If you have extracted "exe"s and "dll"s from Sqlite download link to Ruby's bin folder and still have this problem. Try this:

bundle update

gem uninstall sqlite3

Given a choice between multiple versions of sqlite3, choose last option 'All versions'. Enter last number here

Select gem to uninstall:
1. sqlite3-1.3.13
2. sqlite3-1.3.13-x64-mingw32
3. All versions
>3 .
.
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]
> y

gem install sqlite3 --platform=ruby

rails server

This should work.

Read through this link for more explanation if above works for you.

查看更多
登录 后发表回答