AB10
AB10

Reputation: 1023

Error executing a gem

Initially, I tried to push my application up to heroku with the git push heroku master command and I got this error:

$ git push heroku master
Counting objects: 106, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (94/94), done.
Writing objects: 100% (106/106), 20.47 KiB | 0 bytes/s, done.
Total 106 (delta 21), 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: ###### 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 bundler 1.11.2
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:        Installing json 1.8.3 with native extensions
remote:        Installing i18n 0.7.0
remote:        Installing rake 11.1.2
remote:        Installing minitest 5.8.4
remote:        Installing thread_safe 0.3.5
remote:        Installing builder 3.2.2
remote:        Installing erubis 2.7.0
remote:        Installing mini_portile2 2.0.0
remote:        Installing rack 1.6.4
remote:        Installing mime-types-data 3.2016.0221
remote:        Installing arel 6.0.3
remote:        Using bundler 1.11.2
remote:        Installing sass 3.4.21
remote:        Installing execjs 2.6.0
remote:        Installing coffee-script-source 1.10.0
remote:        Installing thor 0.19.1
remote:        Installing concurrent-ruby 1.0.1
remote:        Installing multi_json 1.11.2
remote:        Installing pg 0.18.4 with native extensions
remote:        Installing rails_serve_static_assets 0.0.5
remote:        Installing rails_stdout_logging 0.0.5
remote:        Installing sqlite3 1.3.11 with native extensions
remote:        Installing tilt 2.0.2
remote:        Installing tzinfo 1.2.2
remote:        Installing nokogiri 1.6.7.2 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        /tmp/build_7c1c7338241e4f828405d4c473f1dfdd/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20160328-319-1a7qvmc.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_7c1c7338241e4f828405d4c473f1dfdd/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_7c1c7338241e4f828405d4c473f1dfdd/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.11 for inspection.
remote:        Results logged to /tmp/build_7c1c7338241e4f828405d4c473f1dfdd/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out
remote:        Installing rack-test 0.6.3
remote:        Installing mime-types 3.0
remote:        Installing rdoc 4.2.2
remote:        Installing autoprefixer-rails 6.3.5
remote:        Installing uglifier 3.0.0
remote:        Installing coffee-script 2.4.1
remote:        Installing sprockets 3.5.2
remote:        Installing rails_12factor 0.0.3
remote:        Installing activesupport 4.2.5
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: 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:        Installing json 1.8.3 with native extensions
remote:        Installing i18n 0.7.0
remote:        Installing rake 11.1.2
remote:        Installing minitest 5.8.4
remote:        Installing thread_safe 0.3.5
remote:        Installing builder 3.2.2
remote:        Installing erubis 2.7.0
remote:        Installing mini_portile2 2.0.0
remote:        Installing rack 1.6.4
remote:        Installing mime-types-data 3.2016.0221
remote:        Installing arel 6.0.3
remote:        Using bundler 1.11.2
remote:        Installing sass 3.4.21
remote:        Installing execjs 2.6.0
remote:        Installing coffee-script-source 1.10.0
remote:        Installing thor 0.19.1
remote:        Installing concurrent-ruby 1.0.1
remote:        Installing multi_json 1.11.2
remote:        Installing pg 0.18.4 with native extensions
remote:        Installing rails_serve_static_assets 0.0.5
remote:        Installing rails_stdout_logging 0.0.5
remote:        Installing sqlite3 1.3.11 with native extensions
remote:        Installing tilt 2.0.2
remote:        Installing tzinfo 1.2.2
remote:        Installing nokogiri 1.6.7.2 with native extensions
remote:
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
remote:        /tmp/build_7c1c7338241e4f828405d4c473f1dfdd/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20160328-319-1a7qvmc.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_7c1c7338241e4f828405d4c473f1dfdd/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_7c1c7338241e4f828405d4c473f1dfdd/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.11 for inspection.
remote:        Results logged to /tmp/build_7c1c7338241e4f828405d4c473f1dfdd/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out
remote:        Installing rack-test 0.6.3
remote:        Installing mime-types 3.0
remote:        Installing rdoc 4.2.2
remote:        Installing autoprefixer-rails 6.3.5
remote:        Installing uglifier 3.0.0
remote:        Installing coffee-script 2.4.1
remote:        Installing sprockets 3.5.2
remote:        Installing rails_12factor 0.0.3
remote:        Installing activesupport 4.2.5
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:
remote:  !     Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to pengame.
remote:
To https://git.heroku.com/pengame.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/

When I try to install a gem I get this error:

$ gem install sqlite3 -v '1.3.11'
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.11-x86-mingw32/lib/sqlite3/2.1/sqlite3_native.so

Here's my Gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.3', '>= 1.3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'bootstrap-sass'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

I'm not sure what I could be doing wrong.

My application works perfectly on the development server.

Anybody know why this might be happening??

Upvotes: 0

Views: 760

Answers (1)

Anthony E
Anthony E

Reputation: 11235

Heroku doesn't support sqlite and is therefore refusing to install the native extensions. Since you're not using sqlite in production you should probably isolate the sqlite gem to environments run on your local machine (i.e. test and dev groups). Though I'd also recommend using Postgres in all environments, including tests, for consistency.

Perhaps you've seen this but there's also a very useful article on Heroku on how to setup Postgres on Heroku here: https://devcenter.heroku.com/articles/getting-started-with-rails4#heroku-gems.

Upvotes: 1

Related Questions