我正在尝试将我的Rails应用程序推送到Heroku,但不断收到此错误。
Installing sqlite3 (1.3.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
这是我的Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'thin'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'twitter-bootstrap-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails', '~> 2.0.1'
gem 'modernizr-rails', '~> 2.0.6'
gem 'will_paginate', '~> 3.0.3'
gem 'simple_form', '~> 2.0.1'
gem 'friendly_id', '~> 4.0.4'
# Authentication
gem 'devise', '~> 2.0.4'
# gem 'recaptcha', :require => 'recaptcha/rails'
# Authorisation
gem 'cancan', '~> 1.6.7'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
这是我的gemlock文件
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.1)
actionpack (= 3.2.1)
mail (~> 2.4.0)
actionpack (3.2.1)
activemodel (= 3.2.1)
activesupport (= 3.2.1)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
activemodel (3.2.1)
activesupport (= 3.2.1)
builder (~> 3.0.0)
activerecord (3.2.1)
activemodel (= 3.2.1)
activesupport (= 3.2.1)
arel (~> 3.0.0)
tzinfo (~> 0.3.29)
activeresource (3.2.1)
activemodel (= 3.2.1)
activesupport (= 3.2.1)
activesupport (3.2.1)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.0)
cancan (1.6.7)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.2.0)
commonjs (0.2.5)
daemons (1.1.8)
devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
railties (~> 3.1)
warden (~> 1.1.1)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.3.0)
multi_json (~> 1.0)
friendly_id (4.0.4)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.6)
less (2.1.0)
commonjs (~> 0.2.0)
therubyracer (~> 0.10.0)
less-rails (2.2.0)
actionpack (>= 3.1)
less (~> 2.1.0)
libv8 (3.3.10.4)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.18)
modernizr-rails (2.0.6)
multi_json (1.2.0)
orm_adapter (0.0.7)
pg (0.13.2)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.1)
actionmailer (= 3.2.1)
actionpack (= 3.2.1)
activerecord (= 3.2.1)
activeresource (= 3.2.1)
activesupport (= 3.2.1)
bundler (~> 1.0)
railties (= 3.2.1)
railties (3.2.1)
actionpack (= 3.2.1)
activesupport (= 3.2.1)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sass (3.1.15)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
simple_form (2.0.1)
actionpack (~> 3.0)
activemodel (~> 3.0)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
therubyracer (0.10.0)
libv8 (~> 3.3.10)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
twitter-bootstrap-rails (2.0.5)
actionpack (>= 3.1)
less-rails (~> 2.2.0)
railties (>= 3.1)
tzinfo (0.3.32)
uglifier (1.2.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.1.1)
rack (>= 1.0)
will_paginate (3.0.3)
PLATFORMS
ruby
DEPENDENCIES
cancan (~> 1.6.7)
coffee-rails (~> 3.2.1)
devise (~> 2.0.4)
friendly_id (~> 4.0.4)
jquery-rails (~> 2.0.1)
modernizr-rails (~> 2.0.6)
pg
rails (= 3.2.1)
sass-rails (~> 3.2.3)
simple_form (~> 2.0.1)
thin
twitter-bootstrap-rails
uglifier (>= 1.0.3)
will_paginate (~> 3.0.3)
我没有对sqlite3的任何引用,但它仍在尝试安装它。我删除了我的gemfile.lock&amp; Bundle install'd然后git add + commit几次。 我哪里错了?非常感谢!
答案 0 :(得分:3)
我建议你为PostgreSQL宝石使用组。我不确定它为什么要安装sqlite3,但这可能会解决它。
group :development, :production do
gem 'pg'
end
答案 1 :(得分:1)
我还有一种情况,Rails似乎没有根据我配置的Gemfile的方式选择使用哪个数据库引擎。
如果您使用的是Mac OS X或Linux,请检查您的环境变量,看看您是否有一个名为“DATABASE_URL”的变量。在我的例子中,Gemfile指定了sqlite3,但我可以告诉Rails使用Postgres,我不知道为什么直到我遇到使用PostgreSQL信息设置的环境变量。
我也会遵循亚当的建议并成立小组。
答案 2 :(得分:0)
确保您将在哪个环境中使用数据库。您正在尝试使用PostgreSQL,但您还没有决定使用它的环境。所以让gem文件中的组使用它。例如
group :development, :production do
gem 'pg'
end