2016-07-29 31 views
0

我更新了我的database.yml添加此无法部署Rails应用到的Heroku,宝石错误(sqlite3的和宝石机扩展)

development: 
    adapter: sqlite3 
    database: db/development.sqlite3 
    pool: 5 
    timeout: 5000 

test: 
    adapter: sqlite3 
    database: db/test.sqlite3 
    pool: 5 
    timeout: 5000 

production: 
    adapter: postgresql 
    database: treebook 
    pool: 5 
    timeout: 5000 

我也更新了我的宝石文件中添加这些块和gem'pg'

group :development do 
    gem 'sqlite3' 
end 

group :production do 
    gem 'pg' 
end 

冉 '创业板安装捆绑'

然后很绝望,甚至在摆脱sqlite并且只使用pg之后尝试了另一次迭代,但是这也不起作用。

这一切

,我仍然感到无法从终端(下同)部署......注:

$ git push heroku master 
Counting objects: 180, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (169/169), done. 
Writing objects: 100% (180/180), 38.52 MiB | 587.00 KiB/s, done. 
Total 180 (delta 16), 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.2.4 
remote: -----> Installing dependencies using bundler 1.11.2 
remote:  Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment 
remote:  Warning: the running version of Bundler is older than the version that created the lockfile. 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:  Installing json 1.8.3 with native extensions 
remote:  Installing i18n 0.7.0 
remote:  Installing rake 11.2.2 
remote:  Installing minitest 5.9.0 
remote:  Installing thread_safe 0.3.5 
remote:  Installing builder 3.2.2 
remote:  Installing erubis 2.7.0 
remote:  Installing mini_portile2 2.1.0 
remote:  Installing pkg-config 1.1.7 
remote:  Installing rack 1.6.4 
remote:  Installing mime-types-data 3.2016.0521 
remote:  Installing arel 6.0.3 
remote:  Installing coffee-script-source 1.10.0 
remote:  Installing execjs 2.7.0 
remote:  Installing thor 0.19.1 
remote:  Using bundler 1.11.2 
remote:  Installing concurrent-ruby 1.0.2 
remote:  Installing multi_json 1.12.1 
remote:  Installing sass 3.4.22 
remote:  Installing tilt 2.0.5 
remote:  Installing sqlite3 1.3.11 with native extensions 
remote:  Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 
remote:  /tmp/build_4e6586368c7df1ddb844833429e54761/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20160729-222-1rjile5.rb 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_4e6586368c7df1ddb844833429e54761/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME) 
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:  extconf failed, exit code 1 
remote:  Gem files will remain installed in /tmp/build_4e6586368c7df1ddb844833429e54761/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.11 for inspection. 
remote:  Results logged to /tmp/build_4e6586368c7df1ddb844833429e54761/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out 
remote:  Installing turbolinks-source 5.0.0 
remote:  Installing tzinfo 1.2.2 
remote:  Installing mime-types 3.1 
remote:  Installing rdoc 4.2.2 
remote:  Installing nokogiri 1.6.8 with native extensions 
remote:  Installing rack-test 0.6.3 
remote:  Installing coffee-script 2.4.1 
remote:  Installing uglifier 3.0.0 
remote:  Installing sprockets 3.6.2 
remote:  An error occurred while installing sqlite3 (1.3.11), and Bundler cannot 
remote:  continue. 
remote:  Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling. 
remote:  Bundler Output: Warning: the running version of Bundler is older than the version that created the lockfile. 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:  Installing json 1.8.3 with native extensions 
remote:  Installing i18n 0.7.0 
remote:  Installing rake 11.2.2 
remote:  Installing minitest 5.9.0 
remote:  Installing thread_safe 0.3.5 
remote:  Installing builder 3.2.2 
remote:  Installing erubis 2.7.0 
remote:  Installing mini_portile2 2.1.0 
remote:  Installing pkg-config 1.1.7 
remote:  Installing rack 1.6.4 
remote:  Installing mime-types-data 3.2016.0521 
remote:  Installing arel 6.0.3 
remote:  Installing coffee-script-source 1.10.0 
remote:  Installing execjs 2.7.0 
remote:  Installing thor 0.19.1 
remote:  Using bundler 1.11.2 
remote:  Installing concurrent-ruby 1.0.2 
remote:  Installing multi_json 1.12.1 
remote:  Installing sass 3.4.22 
remote:  Installing tilt 2.0.5 
remote:  Installing sqlite3 1.3.11 with native extensions 
remote:   
remote:  Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 
remote:   
remote:  /tmp/build_4e6586368c7df1ddb844833429e54761/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20160729-222-1rjile5.rb 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_4e6586368c7df1ddb844833429e54761/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME) 
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:  extconf failed, exit code 1 
remote:   
remote:  Gem files will remain installed in /tmp/build_4e6586368c7df1ddb844833429e54761/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.11 for inspection. 
remote:  Results logged to /tmp/build_4e6586368c7df1ddb844833429e54761/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out 
remote:  Installing turbolinks-source 5.0.0 
remote:  Installing tzinfo 1.2.2 
remote:  Installing mime-types 3.1 
remote:  Installing rdoc 4.2.2 
remote:  Installing nokogiri 1.6.8 with native extensions 
remote:  Installing rack-test 0.6.3 
remote:  Installing coffee-script 2.4.1 
remote:  Installing uglifier 3.0.0 
remote:  Installing sprockets 3.6.2 
remote:  An error occurred while installing sqlite3 (1.3.11), and Bundler cannot 
remote:  continue. 
remote:  Make sure that `gem install sqlite3 -v '1.3.11'` 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: !  Push rejected, failed to compile Ruby app. 
remote: 
remote: !  Push failed 
remote: Verifying deploy... 
remote: 
remote: !  Push rejected to fast-meadow-50982. 
remote: 
To https://git.heroku.com/fast-meadow-50982.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/fast-meadow-50982.git' 
+0

如果您打算在PostgreSQL上部署,我强烈建议您在开发环境中安装PostgreSQL。您的开发,测试和生产环境应该使用相同的堆栈,没有ORM可以保护您的数据库差异。 –

回答

0

你应该做bundle install本地,提交,然后推到Heroku的。
gem install bundler不会从Gemfile安装任何依赖项。
它只是安装bundler本身。

你看过this吗?

+0

所以,我遵循你列出的建议,并链接(谢谢,顺便说一句!),但现在它抛出一个不同的错误: “没有默认语言可以检测到这个应用程序” 我用这个命令, heroku创建--buildpack https://github.com/heroku/heroku- buildpack-ruby.git 但它仍然继续抛出相同的错误代码... –

+0

这个buildpack是否设置了?你可以通过运行'heroku buildpack'来看到它。请注意,您需要运行'heroku buildpacks:set some-buildpack-name'的实际文档[说](https://devcenter.heroku.com/articles/buildpacks#setting-a-buildpack-on-an-application)以便为现有应用程序设置buildpack。 – Aleksey

+0

buildpack表示它已设置,但无论如何,我仍然使用您提供的命令重新建立它,但由于某种原因,它仍然让我“无法检测到set buildpack ...检测失败”:/感谢您坚持这一点我,阿列克谢 –