【问题标题】:Heroku deployment on mac: Failed to build gem native extension, sqlite3.h missingMac 上的 Heroku 部署:无法构建 gem 原生扩展,缺少 sqlite3.h
【发布时间】:2015-02-07 12:05:51
【问题描述】:

我在其他一些问题中寻找解决问题的方法,但即使将它们应用于我的案例,我也无法让 heroku 工作。 我正在关注 railstutorials.org 并在调用时收到以下日志(有错误)

git push heroku master

我在安装了 MacPort、Brew 的 Mac OS X 10.9.4 上运行我的代码,我卸载了 postgresql 并重新安装了它,我已经更新了 Xcode 命令行工具,我也刚刚更新了所有 ruby​​ 库。 我得到了什么:

    -----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from https://rubygems.org/.........
       Installing i18n 0.6.11
       Installing rake 10.4.2
       Installing minitest 5.4.3
       Installing thread_safe 0.3.4
       Installing builder 3.2.2
       Installing erubis 2.7.0
       Installing rack 1.5.2
       Installing mime-types 2.4.3
       Installing coffee-script-source 1.8.0
       Installing execjs 2.2.2
       Installing thor 0.19.1
       Installing hike 1.2.3
       Installing multi_json 1.10.1
       Using bundler 1.6.3
       Installing tilt 1.4.1
       Installing sass 3.2.19
       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
       /tmp/build_923c7430609effe5c7de55d5261b02b6/vendor/ruby-2.0.0/bin/ruby extconf.rb
       checking for sqlite3.h... no
       sqlite3.h is missing. Try 'port install sqlite3 +universal',
       'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
       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.
...
Gem files will remain installed in /tmp/build_923c7430609effe5c7de55d5261b02b6/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection.
       Results logged to /tmp/build_923c7430609effe5c7de55d5261b02b6/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
       Installing json 1.8.1
       Installing arel 5.0.1.20140414130214
       An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
       continue.
       Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
 !
 !     Failed to install gems via Bundler.
 !     
 !     Detected sqlite3 gem which is not supported on Heroku.
 !     https://devcenter.heroku.com/articles/sqlite3
 !

 !     Push rejected, failed to compile Ruby app

我应该怎么做才能让 heroku 与我的代码和库一起工作? 提前谢谢你

【问题讨论】:

  • 您需要从 gemfile 中删除 Sqlite

标签: ruby-on-rails ruby macos heroku sqlite


【解决方案1】:

Heroku 建议在您的 gemfile 中使用 Posgres。

gem 'pg'代替gem 'sqlite3'

完整说明:https://devcenter.heroku.com/articles/sqlite3

【讨论】:

  • 为我工作。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-09-07
  • 2016-12-04
  • 2021-04-19
  • 1970-01-01
  • 1970-01-01
  • 2015-04-11
  • 1970-01-01
相关资源
最近更新 更多