我正在关注本教程http://installfest.railsbridge.org/installfest/deploy_a_rails_app并且我总是失败,因为步骤2.2:准备你的rails应用程序以部署到Heroku ,我对 Gemfile进行了所有更改:
在此文件中,更改行:
gem 'sqlite3'
对此:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
保存文件。
输入后:捆绑安装 - 无需生产
得到这个:
DL is deprecated, please use Fiddle
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.7.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.3
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.2
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.3
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.3
Using globalid 0.3.5
Using activejob 4.2.3
Using mime-types 2.6.1
Using mail 2.6.3
Using actionmailer 4.2.3
Using activemodel 4.2.3
Using arel 6.0.2
Using activerecord 4.2.3
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using columnize 0.9.0
Using byebug 5.0.0
Using coffee-script-source 1.9.1.1
Using execjs 2.5.2
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.3
Using coffee-rails 4.1.0
Using multi_json 1.11.2
Using jbuilder 2.3.1
Using jquery-rails 4.0.4
Using bundler 1.10.6
Using sprockets 3.2.0
Using sprockets-rails 2.3.2
Using rails 4.2.3
Using rdoc 4.2.0
Using sass 3.4.16
Using tilt 1.4.1
Using sass-rails 5.0.3
Using sdoc 0.4.1
Using sqlite3 1.3.10
Using turbolinks 2.5.3
Using tzinfo-data 1.2015.5
Using uglifier 2.7.1
Using web-console 2.2.1
Bundle complete! 12 Gemfile dependencies, 54 gems now installed.
Gems in the groups production and development were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
然后输入: git add。
然后输入: git commit -m“heroku部署的更新”并获取:
On branch master
nothing to commit, working directory clean
输入后: git push heroku master 得到这个:
Counting objects: 90, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (82/82), done.
Writing objects: 100% (90/90), 21.14 KiB | 0 bytes/s, done.
Total 90 (delta 5), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.0.0
remote: ###### WARNING:
remote: Removing `Gemfile.lock` because it was generated on Windows.
remote: Bundler will do a full resolve so native gems are handled properly.
remote: This may result in unexpected gem versions being used in your app.
remote: In rare occasions Bundler may not be able to resolve your dependencies at all.
remote: https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: -----> Installing dependencies using 1.9.7
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
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: Resolving dependencies....
remote: Rubygems 2.0.14 is not threadsafe, so your gems must be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
remote: Installing rake 10.4.2
remote: Installing i18n 0.7.0
remote: Installing json 1.8.3
remote: Installing minitest 5.7.0
remote: Installing thread_safe 0.3.5
remote: Installing tzinfo 1.2.2
remote: Installing activesupport 4.2.3
remote: Installing builder 3.2.2
remote: Installing erubis 2.7.0
remote: Installing mini_portile 0.6.2
remote: Installing nokogiri 1.6.6.2
remote: Installing rails-deprecated_sanitizer 1.0.3
remote: Installing rails-dom-testing 1.0.6
remote: Installing loofah 2.0.2
remote: Installing rails-html-sanitizer 1.0.2
remote: Installing actionview 4.2.3
remote: Installing rack 1.6.4
remote: Installing rack-test 0.6.3
remote: Installing actionpack 4.2.3
remote: Installing globalid 0.3.5
remote: Installing activejob 4.2.3
remote: Installing mime-types 2.6.1
remote: Installing mail 2.6.3
remote: Installing actionmailer 4.2.3
remote: Installing activemodel 4.2.3
remote: Installing arel 6.0.2
remote: Installing activerecord 4.2.3
remote: Using bundler 1.9.7
remote: Installing coffee-script-source 1.9.1.1
remote: Installing execjs 2.5.2
remote: Installing coffee-script 2.4.1
remote: Installing thor 0.19.1
remote: Installing railties 4.2.3
remote: Installing coffee-rails 4.1.0
remote: Installing multi_json 1.11.2
remote: Installing jbuilder 2.3.1
remote: Installing jquery-rails 4.0.4
remote: Installing sprockets 3.2.0
remote: Installing sprockets-rails 2.3.2
remote: Installing rails 4.2.3
remote: Installing rdoc 4.2.0
remote: Installing sass 3.4.16
remote: Installing tilt 1.4.1
remote: Installing sass-rails 5.0.3
remote: Installing sdoc 0.4.1
remote: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
remote: /tmp/build_4ba7021bedd46b4e2762bf06d3285c4c/vendor/ruby-2.0.0/bin/ruby extconf.rb
remote: checking for sqlite3.h... no
remote: sqlite3.h is missing. Try 'port install sqlite3 +universal',
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: 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_4ba7021bedd46b4e2762bf06d3285c4c/vendor/ruby-2.0.0/bin/ruby
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}/
remote: Gem files will remain installed in /tmp/build_4ba7021bedd46b4e2762bf06d3285c4c/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection.
remote: Results logged to /tmp/build_4ba7021bedd46b4e2762bf06d3285c4c/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
remote: An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
remote: Bundler Output: Fetching gem metadata from https://rubygems.org/............
remote: Fetching version metadata from https://rubygems.org/...
remote: Fetching dependency metadata from https://rubygems.org/..
remote: Resolving dependencies....
remote: Rubygems 2.0.14 is not threadsafe, so your gems must be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
remote: Installing rake 10.4.2
remote: Installing i18n 0.7.0
remote: Installing json 1.8.3
remote: Installing minitest 5.7.0
remote: Installing thread_safe 0.3.5
remote: Installing tzinfo 1.2.2
remote: Installing activesupport 4.2.3
remote: Installing builder 3.2.2
remote: Installing erubis 2.7.0
remote: Installing mini_portile 0.6.2
remote: Installing nokogiri 1.6.6.2
remote: Installing rails-deprecated_sanitizer 1.0.3
remote: Installing rails-dom-testing 1.0.6
remote: Installing loofah 2.0.2
remote: Installing rails-html-sanitizer 1.0.2
remote: Installing actionview 4.2.3
remote: Installing rack 1.6.4
remote: Installing rack-test 0.6.3
remote: Installing actionpack 4.2.3
remote: Installing globalid 0.3.5
remote: Installing activejob 4.2.3
remote: Installing mime-types 2.6.1
remote: Installing mail 2.6.3
remote: Installing actionmailer 4.2.3
remote: Installing activemodel 4.2.3
remote: Installing arel 6.0.2
remote: Installing activerecord 4.2.3
remote: Using bundler 1.9.7
remote: Installing coffee-script-source 1.9.1.1
remote: Installing execjs 2.5.2
remote: Installing coffee-script 2.4.1
remote: Installing thor 0.19.1
remote: Installing railties 4.2.3
remote: Installing coffee-rails 4.1.0
remote: Installing multi_json 1.11.2
remote: Installing jbuilder 2.3.1
remote: Installing jquery-rails 4.0.4
remote: Installing sprockets 3.2.0
remote: Installing sprockets-rails 2.3.2
remote: Installing rails 4.2.3
remote: Installing rdoc 4.2.0
remote: Installing sass 3.4.16
remote: Installing tilt 1.4.1
remote: Installing sass-rails 5.0.3
remote: Installing sdoc 0.4.1
remote:
remote: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
remote:
remote: /tmp/build_4ba7021bedd46b4e2762bf06d3285c4c/vendor/ruby-2.0.0/bin/ruby extconf.rb
remote: checking for sqlite3.h... no
remote: sqlite3.h is missing. Try 'port install sqlite3 +universal',
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_4ba7021bedd46b4e2762bf06d3285c4c/vendor/ruby-2.0.0/bin/ruby
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}/
remote:
remote:
remote: Gem files will remain installed in /tmp/build_4ba7021bedd46b4e2762bf06d3285c4c/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10 for inspection.
remote: Results logged to /tmp/build_4ba7021bedd46b4e2762bf06d3285c4c/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
remote: An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Detected sqlite3 gem which is not supported on Heroku.
remote: ! https://devcenter.heroku.com/articles/sqlite3
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to calm-harbor-7665.
remote:
To https://git.heroku.com/calm-harbor-7665.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/calm-harbor-7665.git'
就是这样,我是新人,所以我真的不知道如何解决这个问题
答案 0 :(得分:1)
虽然如果您按照教程进行操作,我会按照Heroku directly
中的说明进行操作首先打开您的Gemfile并删除此行:
gem 'sqlite3'
替换为此行:
gem 'pg'
然后运行bundle install
答案 1 :(得分:0)
首先尝试bundle install --without production
并将更改提交给git,然后尝试将您的工作重新推送到heroku。