尝试将Rails 3.2应用推向Heroku sqlite3错误

时间:2022-12-19 20:39:36

I'm trying to push my Rails app to Heroku but keep getting this error.

我试着把我的Rails应用推给Heroku,但还是有这个错误。

Installing sqlite3 (1.3.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

This is my Gemfile

这是我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'

and this is my gemlock file

这是我的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)

I don't have any references to sqlite3 but it's still trying to install it. I have removed my gemfile.lock & Bundle install'd then git add + commit several times. Where am I going wrong? Many thanks!

我没有对sqlite3的任何引用,但它仍在尝试安装它。我把我的gemfile移走了。锁和捆绑安装然后git添加和提交几次。我哪里做错了?很多谢谢!

3 个解决方案

#1


3  

I'd suggest using groups for your PostgreSQL gem. I'm not sure why it's trying to install sqlite3, but this may fix it.

我建议在PostgreSQL gem中使用组。我不确定为什么要安装sqlite3,但这可能会修复它。

group :development, :production do
  gem 'pg'
end

#2


1  

I also had a situation where Rails did not seem to be choosing which db engine to use based on the way I had the Gemfile configured.

我还遇到过这样的情况:Rails似乎没有根据配置Gemfile的方式选择使用哪个db引擎。

If you're on Mac OS X or Linux, check your environment variables to see if you have one called "DATABASE_URL". In my case, the Gemfile specified sqlite3 but I could tell Rails was using Postgres and I had no idea why until I came across environment variable set up with the PostgreSQL information.

如果您使用的是Mac OS X或Linux,请检查您的环境变量,看看是否有一个名为“DATABASE_URL”的变量。在我的例子中,Gemfile指定了sqlite3,但是我可以看出Rails使用的是Postgres,直到遇到使用PostgreSQL信息设置的环境变量时,我才知道为什么。

I would also follow Adam's advice and set up groups.

我也会听从亚当的建议,成立小组。

#3


0  

Make sure in which environment you are going to use database. You are trying to use PostgreSQL but you haven't decide in which environment you using it. so make group in gem file to use it. For example

确保您将在哪个环境中使用数据库。您正在尝试使用PostgreSQL,但是您还没有决定在哪个环境中使用它。所以制作组在gem文件中使用它。例如

group :development, :production do
  gem 'pg'
end 

#1


3  

I'd suggest using groups for your PostgreSQL gem. I'm not sure why it's trying to install sqlite3, but this may fix it.

我建议在PostgreSQL gem中使用组。我不确定为什么要安装sqlite3,但这可能会修复它。

group :development, :production do
  gem 'pg'
end

#2


1  

I also had a situation where Rails did not seem to be choosing which db engine to use based on the way I had the Gemfile configured.

我还遇到过这样的情况:Rails似乎没有根据配置Gemfile的方式选择使用哪个db引擎。

If you're on Mac OS X or Linux, check your environment variables to see if you have one called "DATABASE_URL". In my case, the Gemfile specified sqlite3 but I could tell Rails was using Postgres and I had no idea why until I came across environment variable set up with the PostgreSQL information.

如果您使用的是Mac OS X或Linux,请检查您的环境变量,看看是否有一个名为“DATABASE_URL”的变量。在我的例子中,Gemfile指定了sqlite3,但是我可以看出Rails使用的是Postgres,直到遇到使用PostgreSQL信息设置的环境变量时,我才知道为什么。

I would also follow Adam's advice and set up groups.

我也会听从亚当的建议,成立小组。

#3


0  

Make sure in which environment you are going to use database. You are trying to use PostgreSQL but you haven't decide in which environment you using it. so make group in gem file to use it. For example

确保您将在哪个环境中使用数据库。您正在尝试使用PostgreSQL,但是您还没有决定在哪个环境中使用它。所以制作组在gem文件中使用它。例如

group :development, :production do
  gem 'pg'
end