gpt4 book ai didi

ruby-on-rails - Rails pdf-extract gem 有 sqlite 作为依赖项,但我使用 pg 因为 Heroku 需要它所以 bundle 安装失败

转载 作者:行者123 更新时间:2023-12-03 18:43:23 25 4
gpt4 key购买 nike

我一直在尝试安装pdf-extract作为我的 Rails 应用程序中的 gem 。当我去构建时,我收到这个错误,因为它使用 sqlite 作为依赖项:

Fetching sqlite3 1.3.13
Installing sqlite3 1.3.13 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/home/vagrant/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20180425-3298-14ft47q.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'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=/home/vagrant/.rbenv/versions/2.3.0/bin/$(RUBY_BASE_NAME)
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/sqlite3-1.3.13/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/sqlite3-1.3.13/gem_make.out

An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.

In Gemfile:
pdf-extract was resolved to 0.1.1, which depends on
sqlite3

无论如何我仍然可以使用pdf-extract吗? Heroku 不允许在生产中使用 sqlite。

任何帮助是极大的赞赏。

编辑:

对于将来遇到此问题的人:我试图破解 gem 以使其与 postgres 一起使用——这似乎有效,尽管它导致 gem 的性能下降。最终,我创建了一个完全独立的仅 api 应用程序,使用 Elastic Beanstalk 而不是通过 Heroku 直接部署到 AWS,以便应用程序可以使用 sqlite3,并调用 api-app 以在我的原始应用程序中实现 gem 功能。

这种方法可能适用于在现有 Rails 应用程序中导致依赖性问题的任何 gem。

最佳答案

如果您无法安装该依赖项,则无法使用具有该依赖项的 gem。你的选择是

  • 使用不同的 PDF Gem
  • 使用 Heroku 的替代品
  • 找到一种方法来实现您自己从 Pdf-extract 中需要的功能,而无需使用任何 gem
  • 查看 gem 的代码以查看它在哪里使用 sqlite 并尝试在不破坏 gem
  • 的情况下摆脱该代码

    关于ruby-on-rails - Rails pdf-extract gem 有 sqlite 作为依赖项,但我使用 pg 因为 Heroku 需要它所以 bundle 安装失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50024123/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com