Rails bundle update 的时候安装 sqlite3 出错

longerian · 2012年03月11日 · 最后由 dengdx 回复于 2019年10月31日 · 6764 次阅读

Ubuntu11.10 环境下: 在执行 bundle update 或 bundle install 的时候,安装 sqlite3 出错,错误日志如下,大意是所缺少一个本地扩展插件的头文件 sqlite3.h,不知道要怎么解决啊???

Installing sqlite3 (1.3.5) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!

/home/longerian/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/home/longerian/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb 
**checking for sqlite3.h... no
sqlite3.h is missing.** Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

你没装 sqlite3 吧?

sudo apt-get install sqlite3 libsqlite3-dev

#1 楼 @AlphaLiu 我是没安装,但我执行 bundle install 的时候也出现这种错误,难道 bundle install 的时候不会顺便安装 sqlite3 吗???

bundle 只是安装 sqlite3 的 adapter,不会安装 sqlite3 的。

Rails 的 database gem 都只是 adapter,sqlite3, mysql2, mogoid 等,数据库的安装和 gem 是没关系的。

#3 楼 @AlphaLiu #4 楼 @willmouse

原来如此啊~~~非常感激! :)

apt-get install nodejs nodejs-dev

ubuntu 有这个问题,最好的办法就是下载 sqlite3 源码自己编译,就行了

我是在 windows 上安装的,也出现类似的问题,但是我已经安装 sqlite3 了,

需要 登录 后方可回复, 如果你还没有账号请 注册新账号