SqLite3 LoadError:不兼容的库版本

时间:2016-05-21 17:03:11

标签: ruby-on-rails ruby-on-rails-4 sqlite

操作系统:Ubuntu 16,Rails 4,Ruby 2.1.2 错误:

LoadError: incompatible library version - /home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.so
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `require'
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `rescue in <top (required)>'
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:2:in `<top (required)>'
/home/user/work/cookbook/config/application.rb:7:in `<top (required)>'
/home/user/work/cookbook/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- sqlite3/2.3/sqlite3_native
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:4:in `require'
/home/user/.rvm/gems/ruby-2.1.2@recipe_box/gems/sqlite3-1.3.11/lib/sqlite3.rb:4:in `<top (required)>'
/home/user/work/cookbook/config/application.rb:7:in `<top (required)>'
/home/user/work/cookbook/Rakefile:4:in `<top (required)>'

Gemfile:

gem 'rails', '4.2.5.1'
gem 'sqlite3'

Gemfile.lock的

sqlite3 (1.3.11)

当我更改文件sqlite3-1.3.11.gemspec时 在s.require_paths = ["lib"]s.require_paths= ["lib/sqlite3_native"]我与另一个宝石(大约10个)有同样的问题,例如here
reinstall宝石不工作


需要做些什么才能解决问题?

1 个答案:

答案 0 :(得分:3)

需要使用sqlite3 gem的lower version 1.3.10 )而不是v.1.3.11 之前如果需要uninstall all gems 并写信至Gemfile

gem 'sqlite3', '~> 1.3', '>= 1.3.10'

并使用$ bundle install

这对我很有帮助