ruby-on-rails - 无法将应用程序部署到 heroku

标签 ruby-on-rails ruby git heroku

我正在学习本教程 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

保存文件。

在我键入:bundle install --without production

得到这个:

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 "Updates for heroku deployment" 并得到:

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'

就是这样,我是新手,所以我真的不知道如何解决这个问题

最佳答案

尽管如果您确实按照教程进行操作,我会按照 Heroku directly 中的说明进行操作

首先打开你的 Gemfile 并删除这一行:

gem 'sqlite3'

替换为这一行:

gem 'pg'

然后运行bundle install

关于ruby-on-rails - 无法将应用程序部署到 heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31779218/

相关文章:

ruby-on-rails - Rails 过时了?站点地图的方法始终返回 HTTP 200

Ruby 字符串切片索引 : str[n. .infinity]

c# - 为什么 C# ProcessStartInfoRedirectStandardOutput 会导致 xcopy 进程失败

ruby - 如何使用 Ruby 从头开始​​初始化对象和设置属性?

Git 无法锁定 ref 'HEAD' : unable to resolve reference HEAD

ruby-on-rails - 如何在不发送 Ruby 的情况下检查电子邮件是否存在?使用 email_veracity_checker

ruby-on-rails - 获取Rails 3中的验证规则列表?

git - 如何通过 Youtrack 时间跟踪上的提交消息设置花费的时间?

git - 将具有多个模块的 CVS 项目转换为一个 git 存储库的最佳方法是什么?

jquery - Rails 和 ajax 全局错误处理问题