gem install sqlite3 有效,捆绑安装无效?

Posted

技术标签:

【中文标题】gem install sqlite3 有效,捆绑安装无效?【英文标题】:gem install sqlite3 works, bundle install doesn't? 【发布时间】:2011-08-09 11:22:13 【问题描述】:
root@localhost:~# which ruby
/usr/local/bin/ruby
root@localhost:~# which gem
/usr/local/bin/gem
root@localhost:~# ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
root@localhost:~# gem -v
1.7.2
root@localhost:~# 

root@localhost:~# gem install bundler
Successfully installed bundler-1.0.12
1 gem installed
......

root@localhost:~/www/blog# bundle install
Fetching source index for http://rubygems.org/
......

使用本机安装 sqlite3 (1.3.3) 扩展 /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `在 build_extensions 中的块中救援': 错误:无法构建原生 gem 延期。 (Gem::Installer::ExtensionBuildError)

    /usr/local/bin/ruby extconf.rb 

Gem 文件将继续安装在 /root/www/blog/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.3 供检查。结果记录到 /root/www/blog/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out 来自 /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in block in build_extensions' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in each' 来自 /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in build_extensions' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in install' 来自 /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/source.rb:96:in install' from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:55:inblock 正在运行' 来自 /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in block in each' from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in each' 来自 /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in each' from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:44:inrun' 来自 /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/installer.rb:8:in install' from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/cli.rb:225:in 安装' 来自 /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:in run' from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/invocation.rb:118:in invoke_task' 来自 /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor.rb:246:in dispatch' from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/vendor/thor/base.rb:389:in start' 来自 /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/bin/bundle:13:in <top (required)>' from /usr/local/bin/bundle:19:inload' 从 /usr/local/bin/bundle:19:in `'

【问题讨论】:

【参考方案1】:

sqlite3-ruby gem 需要 libsqlite3-0 和 libsqlite3-dev。要解决您在 Ubuntu 上使用 OpenSSL、nokogiri 和 SQLite3 时可能遇到的潜在问题,请运行以下命令(写在一行上):

sudo aptitude install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf

【讨论】:

【参考方案2】:

试试这里讨论的解决方案:sqlite3-ruby install error on Ubuntu

【讨论】:

以上是关于gem install sqlite3 有效,捆绑安装无效?的主要内容,如果未能解决你的问题,请参考以下文章

尝试在 mac 上安装 sqlite3“sudo gem install sqlite3”时出错

使用 Ruby On Rails 4.2.5.1 我可以 gem install therubyracer 但捆绑包在 OS X 10.11.1 上失败

Gem::Installer::ExtensionBuildError: 错误: 无法构建 gem 原生扩展 - Aptana

ruby nokogiri gem install mac osx high sierra

gem install 失败并显示“ruby:无效选项 -H(-h 将显示有效选项)(RuntimeError)”

关于bundle install 的一点补充