gpt4 book ai didi

ruby-on-rails - 删除了 sqlite gem 但 Heroku 仍然检测到 sqlite gem 并且失败

转载 作者:行者123 更新时间:2023-11-29 11:56:59 25 4
gpt4 key购买 nike

我正在尝试将 Rails 应用程序部署到 heroku,但出现以下错误。

Detected sqlite3 gem which is not supported on Heroku

我已经从我的项目中删除了对 sqlite3 的任何引用并将其转换为使用“pg”,更新了 Gemfile.lock 并提交了它,但错误仍然存​​在。

这是我的 gemfile

source 'https://rubygems.org'

group :test, :development do
#testing
gem 'rspec-rails', '~ 3.0'
gem 'factory_girl_rails', '~ 4.0'
gem 'guard-rspec', require: false
gem 'faker'
gem 'database_cleaner'
end

# Use postgres as the database for Active Record
gem 'pg'
gem 'rails_12factor'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'

# Use SCSS for stylesheets
gem 'sass-rails', '~ 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~ 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~ 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~ 0.4.0', group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
#gem 'spring', group: :development

# Use ActiveModel has_secure_password
#gem 'bcrypt', '~ 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

ruby '2.0.0'

这是我的database.yml

development:
adapter: postgresql
encoding: SQL_ASCII
database: rock_development
pool: 5


test:
adapter: postgresql
encoding: SQL_ASCII
database: rock_test
pool: 5

这是我的 heroku 日志

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.3.2
Installing minitest 5.4.2
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing erubis 2.7.0
Installing rack 1.5.2
Installing json 1.8.1
Installing mime-types 1.25.1
Installing polyglot 0.3.5
Installing arel 5.0.1.20140414130214
Installing coffee-script-source 1.8.0
Installing execjs 2.2.2
Installing thor 0.19.1
Installing hike 1.2.3
Using bundler 1.6.3
Installing multi_json 1.10.1
Installing tilt 1.4.1
Installing sass 3.2.19
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_29a41245e46646e56496208f95c41c97/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_29a41245e46646e56496208f95c41c97/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_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
Installing tzinfo 1.2.2
Installing bcrypt 3.1.7
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 Output: Fetching gem metadata from https://rubygems.org/.........
Installing i18n 0.6.11
Installing rake 10.3.2
Installing minitest 5.4.2
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing erubis 2.7.0
Installing rack 1.5.2
Installing json 1.8.1
Installing mime-types 1.25.1
Installing polyglot 0.3.5
Installing arel 5.0.1.20140414130214
Installing coffee-script-source 1.8.0
Installing execjs 2.2.2
Installing thor 0.19.1
Installing hike 1.2.3
Using bundler 1.6.3
Installing multi_json 1.10.1
Installing tilt 1.4.1
Installing sass 3.2.19

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/tmp/build_29a41245e46646e56496208f95c41c97/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_29a41245e46646e56496208f95c41c97/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_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /tmp/build_29a41245e46646e56496208f95c41c97/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
Installing tzinfo 1.2.2
Installing bcrypt 3.1.7
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.
!
! 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

最佳答案

问题解决了。这实际上是我如何使用 git 的问题。我创建了一个新分支来进行从 sqlite 到 ppsql 的更改,并且我试图从该分支推送到 heroku。事实证明,当您说“git push heroku master”时,它不是从您当前的分支推送,而是从 master 分支推送。在我的例子中,它仍然被配置为使用 sqlite。要解决此问题,请在推送到 heroku 之前先与您的 master 分支合并。

关于ruby-on-rails - 删除了 sqlite gem 但 Heroku 仍然检测到 sqlite gem 并且失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27124585/

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