2013-04-25 178 views
2

我的目标是在Heroku上为应用程序'heroku_production'部署应用程序。在Heroku上部署应用程序时不应用BUNDLE_WITHOUT

我的Gemfile看起来是这样的:

source 'https://rubygems.org' 

gem 'rails', '3.2.9' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

group :development, :test, :production do 
    gem 'sqlite3' 
end 
# This is needed in case this app is deployed in Heroku - in order to make the Heroku deployment independent from the production environment 
group :heroku_production do 
    gem 'pg' 
end 
... 

我设置BUNDLE_WITHOUT变量 “发展:测试:生产”。下面是调用heroku config --app my_app当输出:

=== my_app Config Vars 
BUNDLE_WITHOUT:    development:test:production 
DATABASE_URL:    postgres://XXXXXXX.... 
HEROKU_POSTGRESQL_CYAN_URL: postgres://XXXXXXX.... 
RACK_ENV:     heroku_production 
RAILS_ENV:     heroku_production 

但是,当我把我的东西的Heroku没有应用BUNDLE_WITHOUT var当成你可以在下面的错误信息看(3号线:--without发展:测试):

-----> Ruby/Rails app detected 
-----> Installing dependencies using Bundler version 1.3.2 
     Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment 
     Fetching gem metadata from https://rubygems.org/......... 
     Fetching gem metadata from https://rubygems.org/.. 
     Using rake (10.0.4) 
     ... 
     Using pg (0.14.1) 
     Installing sqlite3 (1.3.7) 
     Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 
     /usr/local/bin/ruby extconf.rb 
     checking for sqlite3.h... no 
     sqlite3.h is missing. Try 'port install sqlite3 +universal' 
     or 'yum install sqlite-devel' and check your shared library search path (the 
     location where your sqlite3 shared library is located). 
     *** extconf.rb failed *** 

     An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue. 
     Make sure that `gem install sqlite3 -v '1.3.7'` succeeds before bundling. 
! 
!  Failed to install gems via Bundler. 
! 
!  Heroku push rejected, failed to compile Ruby/rails app 

To [email protected]:my_app.git 
! [remote rejected] 3dac67374c268d3bf9e051a6db39efc56ae81c76 -> master (pre-receive hook declined) 

为什么Heroku会这么做?
谷歌搜索没有帮助。

回答

1

我最近接触的Heroku了这个问题,他们说,现在BUNDLE_WITHOUT工作!

这是我得到的回应:

嗨, user_env_compile已过时,但这一功能,只需成为默认为Ruby buildpack - 所以你可以使用BUNDLE_WITHOUT配置变种。 我相信你看到了这篇文章,但是这是否正确? https://devcenter.heroku.com/articles/bundler#specifying-gems-and-groups 似乎我们需要更新该文档! 最佳, [节录名]

有不尽快尝试过,但会。