【问题标题】:Deploying to Heroku error with sqlite3使用 sqlite3 部署到 Heroku 错误
【发布时间】:2014-06-07 00:22:40
【问题描述】:

我正在尝试将我的 rails 应用程序部署到 Heroku,这样我就可以拥有一个暂存服务器,但一直遇到以下错误。

我已从我的 gemfile 中删除了“sqlite3”gem,并确保当前已安装了“pg”gem,并将我的 database.yml 更改为以下...但仍然收到 sqlite3 错误。有什么建议吗?

development:
adapter: postgresql
encoding: unicode
database: app-name
pool: 5
port: 5432
host: localhost

test:
adapter: postgresql
encoding: unicode
database: app-name
pool: 5
port: 5432
host: localhost

Gem::Installer::ExtensionBuildError: ERROR: 未能构建 gem 原生扩展。

   /tmp/build_a4c50f3d-ca0b-4757-b846-70093165281e/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.

   Provided configuration options:
   --with-opt-dir
   --without-opt-dir
   --with-opt-include
   --without-opt-include=${opt-dir}/include
   --with-opt-lib
   --without-opt-lib=${opt-dir}/lib
   --with-make-prog
   --without-make-prog
   --srcdir=.
   --curdir
   --ruby=/tmp/build_a4c50f3d-ca0b-4757-b846-70093165281e/vendor/ruby-2.0.0/bin/ruby
   --with-sqlite3-dir
   --without-sqlite3-dir
   --with-sqlite3-include
   --without-sqlite3-include=${sqlite3-dir}/include
   --with-sqlite3-lib
   --without-sqlite3-lib=${sqlite3-dir}/
   --enable-local
   --disable-local


   Gem files will remain installed in /tmp/build_a4c50f3d-ca0b-4757-b846-70093165281e/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
   Results logged to /tmp/build_a4c50f3d-ca0b-4757-b846-70093165281e/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
   Installing transitions (0.1.11)
   Installing pg (0.17.0)
   Installing ffi (1.9.3)
   An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.

! !无法通过 Bundler 安装 gem。 ! !检测到 Heroku 不支持的 sqlite3 gem。 ! https://devcenter.heroku.com/articles/sqlite3

! Push 被拒绝,无法编译 Ruby 应用

【问题讨论】:

  • 在此处发布您的 gem 文件。
  • 删除 Gemlock 文件,然后再次捆绑 gem。
  • 我真的明白了。更改 gemfile 后我没有提交,这阻止了它注意到更改。感谢回复

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


【解决方案1】:

我也收到了同样的错误消息。我通过在我的 Sublime Text 2 编辑器中编辑 Activerecord/Activesupport gem 解决了这个问题。我用 postgresql 替换了 sqlite3。但是必须确保已下载并安装了适当版本的 postgresql。错误信息是开发者最好的朋友。学习阅读和理解错误信息。起初很沮丧,但实际上,你最好的朋友和好老师。谢谢大家。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-16
    • 2018-05-08
    • 2012-10-12
    • 2016-08-26
    • 1970-01-01
    • 2011-03-25
    相关资源
    最近更新 更多