简体   繁体   English

Heroku:无法通过Bundler安装gem-无法部署到Heroku

[英]Heroku: Failed to install gems via Bundler - Trouble deploying to Heroku

I've been trying to push my Rails app to Heroku for the last few hours using git push heroku master and have been running into problems. 在过去的几个小时中,我一直在尝试使用git push heroku master将我的Rails应用程序推送到Heroku并遇到问题。 This is the output: 这是输出:

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)

I've tried bundle update and bundle install again and ran git push heroku master but it still didn't do anything. 我试过bundle update并再次bundle install ,然后运行git push heroku master但它仍然没有执行任何操作。

I also tried delete my Gemfile.lock file, ran bundle update and bundle install again, git add and git commit and ran git push heroku master with no results. 我也尝试删除我的Gemfile.lock文件,运行bundle update并再次bundle installgit addgit commit以及git push heroku master没有结果。

This is a copy of my Gemfile: 这是我的Gemfile的副本:

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]

This is my .gitignore 这是我的.gitignore

# See https://help.github.com/articles/ignoring-files for more about 
ignoring files.
#
# If you find yourself ignoring temporary files generated by your text 
editor
# or operating system, you probably want to add a global ignore instead:
#   git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

/node_modules
/yarn-error.log

.byebug_history

I've also deleted my Gemfile.lock rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock , ran bundle install``git add and git commit and tried pushing it up to Heroku again with no luck. 我还删除了我的Gemfile.lock rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock -rf〜 rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock ,运行bundle install``git add git commit bundle install``git addgit commit并尝试再次将其推送到Heroku并没有运气。

Heroku cant install sqlite3 gem, so you need to replace it with pg gem in production. Heroku无法安装sqlite3 gem,因此在生产中需要用pg gem替换它。 Change your Gemfile like so: 像这样更改您的Gemfile:

group :development, :test do
 gem 'sqlite3'
end

group :production do
 gem 'pg'
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM