Ruby on rails Heroku:无法通过捆绑程序安装gems-部署到Heroku时出现问题
在过去的几个小时里,我一直试图使用git push Heroku master将我的Rails应用程序推送到Heroku,但一直遇到问题。这是输出:Ruby on rails Heroku:无法通过捆绑程序安装gems-部署到Heroku时出现问题,ruby-on-rails,ruby,heroku,gemfile,ruby-on-rails-5.1,Ruby On Rails,Ruby,Heroku,Gemfile,Ruby On Rails 5.1,在过去的几个小时里,我一直试图使用git push Heroku master将我的Rails应用程序推送到Heroku,但一直遇到问题。这是输出: remote: Compressing source files... done. remote: Building source: remote: remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The f
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! Warning: Multiple default buildpacks reported the ability
to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby,Node.js
remote: See
https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.4.4
remote: -----> Installing dependencies using bundler 1.15.2
remote: Running: bundle install --without development:test --path
vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler (1.15.2) is older
than the version that created the lockfile (1.16.3). We suggest you
upgrade to the latest version of Bundler by running `gem install
bundler`.
remote: Fetching gem metadata from https://rubygems.org/.........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
remote: Fetching rake 12.3.1
remote: Fetching concurrent-ruby 1.0.5
remote: Fetching minitest 5.11.3
remote: Installing minitest 5.11.3
remote: Installing rake 12.3.1
remote: Installing concurrent-ruby 1.0.5
remote: Fetching thread_safe 0.3.6
remote: Installing thread_safe 0.3.6
remote: Fetching builder 3.2.3
remote: Installing builder 3.2.3
remote: Fetching erubi 1.7.1
remote: Fetching mini_portile2 2.3.0
remote: Installing erubi 1.7.1
remote: Installing mini_portile2 2.3.0
remote: Fetching crass 1.0.4
remote: Fetching rack 2.0.5
remote: Installing crass 1.0.4
remote: Fetching nio4r 2.3.1
remote: Installing nio4r 2.3.1 with native extensions
remote: Installing rack 2.0.5
remote: Fetching websocket-extensions 0.1.3
remote: Installing websocket-extensions 0.1.3
remote: Fetching mini_mime 1.0.0
remote: Installing mini_mime 1.0.0
remote: Fetching arel 8.0.0
remote: Installing arel 8.0.0
remote: Fetching execjs 2.7.0
remote: Fetching bcrypt 3.1.12
remote: Installing execjs 2.7.0
remote: Installing bcrypt 3.1.12 with native extensions
remote: Fetching rb-fsevent 0.10.3
remote: Installing rb-fsevent 0.10.3
remote: Fetching ffi 1.9.25
remote: Installing ffi 1.9.25 with native extensions
remote: Using bundler 1.15.2
remote: Fetching chronic 0.10.2
remote: Installing chronic 0.10.2
remote: Fetching coffee-script-source 1.12.2
remote: Installing coffee-script-source 1.12.2
remote: Fetching method_source 0.9.0
remote: Installing method_source 0.9.0
remote: Fetching thor 0.20.0
remote: Installing thor 0.20.0
remote: Fetching orm_adapter 0.5.0
remote: Installing orm_adapter 0.5.0
remote: Fetching devise-bootstrapped 0.1.1
remote: Installing devise-bootstrapped 0.1.1
remote: Fetching multi_json 1.13.1
remote: Installing multi_json 1.13.1
remote: Fetching puma 3.12.0
remote: Installing puma 3.12.0 with native extensions
remote: Fetching tilt 2.0.8
remote: Installing tilt 2.0.8
remote: Fetching sqlite3 1.3.13
remote: Installing sqlite3 1.3.13 with native extensions
remote: Fetching turbolinks-source 5.1.0
remote: Installing turbolinks-source 5.1.0
remote: Fetching i18n 1.0.1
remote: Installing i18n 1.0.1
remote: Fetching tzinfo 1.2.5
remote: Installing tzinfo 1.2.5
remote: Fetching nokogiri 1.8.4
remote: Installing nokogiri 1.8.4 with native extensions
remote: Fetching websocket-driver 0.6.5
remote: Installing websocket-driver 0.6.5 with native extensions
remote: Fetching mail 2.7.0
remote: Installing mail 2.7.0
remote: Fetching rack-test 1.0.0
remote: Installing rack-test 1.0.0
remote: Fetching warden 1.2.7
remote: Installing warden 1.2.7
remote: Fetching sprockets 3.7.2
remote: Installing sprockets 3.7.2
remote: Fetching autoprefixer-rails 9.0.0
remote: Installing autoprefixer-rails 9.0.0
remote: Fetching uglifier 4.1.15
remote: Installing uglifier 4.1.15
remote: Fetching whenever 0.10.0
remote: Installing whenever 0.10.0
remote: Fetching coffee-script 2.4.1
remote: Installing coffee-script 2.4.1
remote: Fetching rb-inotify 0.9.10
remote: Installing rb-inotify 0.9.10
remote: Fetching turbolinks 5.1.1
remote: Installing turbolinks 5.1.1
remote: Fetching faker 1.9.1
remote: Installing faker 1.9.1
remote: Fetching activesupport 5.1.6
remote: Installing activesupport 5.1.6
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native
extension.
remote:
remote: current directory:
remote:
remote: /tmp/build_4bda83927de17e82c06097acea1b6b55/vendor/ruby-
2.4.4/bin/ruby -r
remote: ./siteconf20180718-265-17bd8cb.rb extconf.rb
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: --curdir
remote: --
ruby=/tmp/build_4bda83927de17e82c06097acea1b6b55/vendor/ruby-
2.4.4/bin/$(RUBY_BASE_NAME)
remote: --with-sqlite3-config
remote: --without-sqlite3-config
remote: --with-pkg-config
remote: --without-pkg-config
remote: --with-sqlite3-dir
remote: --without-sqlite3-dir
remote: --with-sqlite3-include
remote: --without-sqlite3-include=${sqlite3-dir}/include
remote: --with-sqlite3-lib
remote: --without-sqlite3-lib=${sqlite3-dir}/lib
remote:
remote: To see why this extension failed to compile, please check
the mkmf.log which can
remote: be found here:
remote:
remote:
remote:
remote: extconf failed, exit code 1
remote:
remote: Gem files will remain installed in
remote:
remote: for inspection.
remote: Results logged to
remote:
remote:
remote: An error occurred while installing sqlite3 (1.3.13), and
Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.13'` succeeds
before bundling.
remote:
remote: In Gemfile:
remote: sqlite3
remote: Bundler Output: Warning: the running version of Bundler
(1.15.2) is older than the version that created the lockfile (1.16.3).
We suggest you upgrade to the latest version of Bundler by running `gem
install bundler`.
remote: Fetching gem metadata from https://rubygems.org/.........
remote: Fetching version metadata from https://rubygems.org/..
remote: Fetching dependency metadata from https://rubygems.org/.
remote: Fetching rake 12.3.1
remote: Fetching concurrent-ruby 1.0.5
remote: Fetching minitest 5.11.3
remote: Installing minitest 5.11.3
remote: Installing rake 12.3.1
remote: Installing concurrent-ruby 1.0.5
remote: Fetching thread_safe 0.3.6
remote: Installing thread_safe 0.3.6
remote: Fetching builder 3.2.3
remote: Installing builder 3.2.3
remote: Fetching erubi 1.7.1
remote: Fetching mini_portile2 2.3.0
remote: Installing erubi 1.7.1
remote: Installing mini_portile2 2.3.0
remote: Fetching crass 1.0.4
remote: Fetching rack 2.0.5
remote: Installing crass 1.0.4
remote: Fetching nio4r 2.3.1
remote: Installing nio4r 2.3.1 with native extensions
remote: Installing rack 2.0.5
remote: Fetching websocket-extensions 0.1.3
remote: Installing websocket-extensions 0.1.3
remote: Fetching mini_mime 1.0.0
remote: Installing mini_mime 1.0.0
remote: Fetching arel 8.0.0
remote: Installing arel 8.0.0
remote: Fetching execjs 2.7.0
remote: Fetching bcrypt 3.1.12
remote: Installing execjs 2.7.0
remote: Installing bcrypt 3.1.12 with native extensions
remote: Fetching rb-fsevent 0.10.3
remote: Installing rb-fsevent 0.10.3
remote: Fetching ffi 1.9.25
remote: Installing ffi 1.9.25 with native extensions
remote: Using bundler 1.15.2
remote: Fetching chronic 0.10.2
remote: Installing chronic 0.10.2
remote: Fetching coffee-script-source 1.12.2
remote: Installing coffee-script-source 1.12.2
remote: Fetching method_source 0.9.0
remote: Installing method_source 0.9.0
remote: Fetching thor 0.20.0
remote: Installing thor 0.20.0
remote: Fetching orm_adapter 0.5.0
remote: Installing orm_adapter 0.5.0
remote: Fetching devise-bootstrapped 0.1.1
remote: Installing devise-bootstrapped 0.1.1
remote: Fetching multi_json 1.13.1
remote: Installing multi_json 1.13.1
remote: Fetching puma 3.12.0
remote: Installing puma 3.12.0 with native extensions
remote: Fetching tilt 2.0.8
remote: Installing tilt 2.0.8
remote: Fetching sqlite3 1.3.13
remote: Installing sqlite3 1.3.13 with native extensions
remote: Fetching turbolinks-source 5.1.0
remote: Installing turbolinks-source 5.1.0
remote: Fetching i18n 1.0.1
remote: Installing i18n 1.0.1
remote: Fetching tzinfo 1.2.5
remote: Installing tzinfo 1.2.5
remote: Fetching nokogiri 1.8.4
remote: Installing nokogiri 1.8.4 with native extensions
remote: Fetching websocket-driver 0.6.5
remote: Installing websocket-driver 0.6.5 with native extensions
remote: Fetching mail 2.7.0
remote: Installing mail 2.7.0
remote: Fetching rack-test 1.0.0
remote: Installing rack-test 1.0.0
remote: Fetching warden 1.2.7
remote: Installing warden 1.2.7
remote: Fetching sprockets 3.7.2
remote: Installing sprockets 3.7.2
remote: Fetching autoprefixer-rails 9.0.0
remote: Installing autoprefixer-rails 9.0.0
remote: Fetching uglifier 4.1.15
remote: Installing uglifier 4.1.15
remote: Fetching whenever 0.10.0
remote: Installing whenever 0.10.0
remote: Fetching coffee-script 2.4.1
remote: Installing coffee-script 2.4.1
remote: Fetching rb-inotify 0.9.10
remote: Installing rb-inotify 0.9.10
remote: Fetching turbolinks 5.1.1
remote: Installing turbolinks 5.1.1
remote: Fetching faker 1.9.1
remote: Installing faker 1.9.1
remote: Fetching activesupport 5.1.6
remote: Installing activesupport 5.1.6
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native
extension.
remote:
remote: current directory:
remote:
remote: /tmp/build_4bda83927de17e82c06097acea1b6b55/vendor/ruby-
2.4.4/bin/ruby -r
remote: ./siteconf20180718-265-17bd8cb.rb extconf.rb
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: --curdir
remote: --
remote: --with-sqlite3-config
remote: --without-sqlite3-config
remote: --with-pkg-config
remote: --without-pkg-config
remote: --with-sqlite3-dir
remote: --without-sqlite3-dir
remote: --with-sqlite3-include
remote: --without-sqlite3-include=${sqlite3-dir}/include
remote: --with-sqlite3-lib
remote: --without-sqlite3-lib=${sqlite3-dir}/lib
remote:
remote: To see why this extension failed to compile, please check
the mkmf.log which can
remote: be found here:
remote:
remote:
remote:
remote: extconf failed, exit code 1
remote:
remote: Gem files will remain installed in
remote:
remote: for inspection.
remote: Results logged to
remote:
remote:
remote: An error occurred while installing sqlite3 (1.3.13), and
Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.13'` succeeds
before bundling.
remote:
remote: In Gemfile:
remote: sqlite3
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: ! Detected sqlite3 gem which is not supported on Heroku:
remote: ! https://devcenter.heroku.com/articles/sqlite3
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to glacial-reaches-77008.
remote:
To https://git.heroku.com/glacial-reaches-77008.git
! [remote rejected] master -> master (pre-receive hook declined)
我再次尝试了bundle update
和bundle install
并运行了git-push-heroku-master
,但它仍然没有做任何事情
我还尝试删除我的Gemfile.lock文件,再次运行bundle update
和bundle install
,git add
和git commit
并运行git push heroku master
,但没有结果
这是我的文件的副本:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'bootstrap-sass', '~> 3.3.7'
gem 'jquery-rails'
gem 'growlyflash'
gem 'devise'
gem 'devise-bootstrapped'
gem 'whenever', require: false
gem 'faker'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more:
https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more:
https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a
debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
gem 'pry-rails'
gem 'binding_of_caller'
gem 'better_errors'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %>
anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in
the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
我还删除了我的Gemfile.lock
rm-rf~/.bundle/~/.gem/.bundle/Gemfile.lock
,运行了bundle安装``git add
和git commit
,并尝试将其再次推送到Heroku,但没有成功。Heroku无法安装sqlite3 gem,因此在生产中需要将其替换为pg gem
。按如下方式更改您的文件:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
您需要关注heroku上项目部署的初始博客。不支持sqlite,应使用Postgres。更换gem并根据需要进行适当的代码更改。
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end