如何修复“ sqlite3.h丢失”?

时间:2019-05-29 10:41:01

标签: ruby-on-rails

我正在尝试用红宝石做一些项目,使之像这样

git commit -am“添加你好” heroku创建 git push heroku master

然后我收到此错误

remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'brew install sqlite3',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
remote:        and check your shared library search path (the
remote:        location where your sqlite3 shared library is located).
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:
remote:        Provided configuration options:
remote:         --with-opt-dir
remote:         --without-opt-dir
remote:         --with-opt-include
remote:         --without-opt-include=${opt-dir}/include
remote:         --with-opt-lib
remote:         --without-opt-lib=${opt-dir}/lib
remote:         --with-make-prog
remote:         --without-make-prog
remote:         --srcdir=.
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'brew install sqlite3',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
remote:        and check your shared library search path (the
remote:        location where your sqlite3 shared library is located).
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:
remote:        Provided configuration options:
remote:         --with-opt-dir
remote:         --without-opt-dir
remote:         --with-opt-include
remote:         --without-opt-include=${opt-dir}/include
remote:         --with-opt-lib
remote:         --without-opt-lib=${opt-dir}/lib
remote:         --with-make-prog
remote:         --without-make-prog
remote:         --srcdir=.

我试图像本教程https://devcenter.heroku.com/articles/sqlite3和本教程Detected sqlite3 gem which is not supported on Heroku一样更改我的gemfile,但没有任何改变。

我试图以此安装sqlite3

gem install sqlite3

和成功,但没有任何改变。当我想推送heroku master时,仍然给我错误。

能给我任何建议吗?

3 个答案:

答案 0 :(得分:0)

从gemfile中删除sqlite(或使其仅位于开发/测试组中)后,运行bundle install并提交更改。

重点是heroku是基于容器的,您需要与本地计算机区分开来-本地文件仅在提交和推送时才到达本地,然后heroku建立一个只读文件(严格来说,它的“磁盘”可以,但是所有更改都可能在任何时候丢失),然后容器就会运行。

答案 1 :(得分:0)

我刚从a Reddit post中读到,最近RoR中的SQLite版本控制存在错误,它可能与此有关。像下面这样指出特定版本的SQLite 确实对我有用!

因此,在您的Gemfile中,替换为:

gem 'sqlite3'

与此:

gem 'sqlite3', '~> 1.3', '< 1.4'

答案 2 :(得分:0)

当我尝试创建一个新的 rails 项目时遇到了同样的问题。我通过在 Ubuntu 上运行此命令(基于终端输出错误消息中的指令)解决了这个问题:sudo apt-get install libsqlite3-dev 然后在安装后,我重新创建项目并且它可以工作。 我假设您的计算机上安装了 sqlite3。如果未安装可以运行该命令sudo apt install sqlite3,则可以运行上述命令。

相关问题