Ruby on rails git push heroku master issue with sqlite3 - ruby-on-rails

i know this is an old issue and i saw many questions related to the same issue. I still keep getting the same error. I followed the solutions and changed my gemfile accordingly but i still get the same issue. Im using ubuntu.
Below is my issue when i run git push heroku master as said in Michael Hartl's tutorial:
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_t7ck4nq1x4dd/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6 for inspection.
Results logged to /tmp/build_t7ck4nq1x4dd/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
To git#heroku.com:pure-dusk-8885.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:pure-dusk-8885.git'
Here is my Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
gem 'taps'
gem 'rvm'
end
# 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'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
Please help

As Ryan Bigg said you should have the same environment in both development and production so you don't have surprises later when you deploy to production.
But if you don't care about that and want to keep with sqlite I think you only need to run bundle install. I guess you changed your GemFile but didn't ran bundle install.

Remove sqlite3 from your Gemfile. Develop using only the pg gem, so that you're developing on exactly the same database system as what you're deploying to.
If you're not doing this, then you may run into problems when you transition between the two database systems.

Related

bundle install gives error could not find email_spec-1.0.0 in any of the sources

I am new to RoR. I have got to open a project that is already created. The folder did not contain bin folder, I copied the contents of bin folder from some other project (which runs and which I have created by following this) to the current. Now when I move to the path/to/bin/ and give rails server, it gives, could not find somegem name in any of the sources. try bundle install.
If I install the gem using gem install gemname -v=versionnumber, it installs properly. But if I give the command bundle install it gives the error
could not find email_spec-1.0.0 in any of the sources
I know copying files is not the correct way to do. But how can I try running the project? or how can we solve this error in particular.
.I also found that the particular version is yanked, I downloaded email_spec 1.0.0 from RubyGems.org from outside. How do I proceed now?
edit::
This is my gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'mysql2'
gem 'haml-rails'
gem 'jquery-rails'
gem 'devise'
gem 'cancan'
gem 'paperclip'
gem 'recurly'
gem 'hoptoad_notifier'
gem 'whenever', :require => false
gem "friendly_id", "~> 3.1"
gem "will_paginate"
gem "fastercsv"
gem 'meta-tags', :require => 'meta_tags'
gem 'acts-as-taggable-on'
gem 'thin'
gem 'faye', '0.5.5'
gem 'rack-ssl', :require => 'rack/ssl'
gem 'localized_country_select'
group :development, :test do
gem 'ruby-debug'
gem 'rspec-rails'
gem 'cucumber'
gem 'cucumber-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails'
gem 'cucumber'
gem 'rspec-rails'
gem 'spork'
gem 'launchy'
gem 'factory_girl_rails'
gem 'hpricot'
gem 'ruby_parser'
gem 'rest-client'
gem 'email_spec'
end
Edit:
As per the comment, I deleted the Gemfile.lock and tried running bundle install again. Now the problem is, it gives the following error
An error occured while installing linecache (0.46) and bundler can not continue. Make sure that gem install linecache -v '0.46' succeeds
I tried giving the command gem install linecache -v=0.46
and it gives some error Gemfiles will remain installed in C:\Ruby193\lib\ruby\gems\1.9.1\gems\linecache-0.46 for inspection.
Results logged to C:\Ruby193\lib\ruby\gems\1.9.1\gems\linecache-0.46\ext\gem_make.out
This particular file has these contents:
C:/Ruby193/bin/ruby.exe extconf.rb
Can't handle 1.9.x yet
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby193/bin/ruby
what should i do now?
Try removing Gemfile.lock and running bundle install again.

Can't upload to Heroku with SQLite in test group

There is my Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/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', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use RSpec & FactoryGirl for testing
group :test do
gem 'rspec-rails'
gem 'factory_girl_rails'
end
group :test, :development do
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
end
group :production do
gem 'pg'
end
# Use annotations for models
gem 'annotate', '>=2.6.0'
# Time and date validations
gem 'validates_timeliness'
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
When I use 'git push heroku development:master' I've got the following error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_b80818e5-941b-4e0a-b519-dfd1f819a11e/vendor/ruby-2.0.0/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 ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/tmp/build_b80818e5-941b-4e0a-b519-dfd1f819a11e/vendor/ruby-2.0.0/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_b80818e5-941b-4e0a-b519-dfd1f819a11e/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /tmp/build_b80818e5-941b-4e0a-b519-dfd1f819a11e/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!
! Push rejected, failed to compile Ruby app
How can I fix it? Thanks.
you have got gem validate_timeliness which requires sqlite3. As far as I know you can not use anything other than Postgres on Heroku, so you have to get rid of it somehow*. You can use gem dependency -R to see dependency tree (but only first level) of your gems.
* Not true - see comment below.

Bundle Update Unicorn Error

Rails 4.0.1 is available and trying to update to that version (currently on version 4.0)
I'm running bundle update and it starts to work ok but then getting an error that seems to be about Unicorn so the whole thing is aborted. The error is as follows:
Installing unicorn (4.7.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/myname/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb
checking for SIZEOF_OFF_T in ruby.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/myname/.rbenv/versions/2.0.0-p247/bin/ruby
/Users/myname/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.
Any idea how I can get round this problem?
GEM FILE
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'pg'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'jquery-ui-rails'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
gem 'bcrypt-ruby', '~> 3.0.1'
gem "figaro"
gem 'unicorn'
group :production do
gem 'rails_12factor'
end
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'memcachier'
gem 'dalli'
gem 'devise'
Try running
brew update
I'm not so familiar with unicorn, but when you upgrade to a new operating system, that can sometimes be required to get gems and plugins to work properly.
I have a few ideas.
change your gem file to the following:
gem "unicorn", "~> 4.7.0"
I don't use the ruby gems website often. I usually just look at github, but according to the website, there are some dependancies you don't have.
Having upgraded to Mavericks OS recently (and the new version of XCode) I needed to agree to the Xcode Terms & Conditions before the bundle update would work.
Anyway - all working now.

Can't push code to heroku

git push heroku master
Using rails (3.2.13)
Installing rdiscount (2.0.7.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for random()... yes
checking for srandom()... yes
checking for rand()... yes
checking for srand()... yes
checking size of unsigned long... long
checking size of unsigned int... int
no int with size 4
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-rdiscount-dir
--without-rdiscount-dir
--with-rdiscount-include
--without-rdiscount-include=${rdiscount-dir}/include
--with-rdiscount-lib
--without-rdiscount-lib=${rdiscount-dir}/lib
Gem files will remain installed in /tmp/build_cnp5x6n0104p/vendor/bundle/ruby/1.9.1/gems/rdiscount-2.0.7.2 for inspection.
Results logged to /tmp/build_cnp5x6n0104p/vendor/bundle/ruby/1.9.1/gems/rdiscount-2.0.7.2/ext/gem_make.out
An error occurred while installing rdiscount (2.0.7.2), and Bundler cannot
continue.
Make sure that `gem install rdiscount -v '2.0.7.2'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
Here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'bootstrap-sass', '2.1'
gem 'google-webfonts'
gem 'postmarkdown'
gem 'rdiscount', "~> 2.0.7.2"
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
group :test do
gem 'capybara', '1.1.2'
end
group :production do
gem 'pg', '0.12.2'
end
I seemed to start to have problems after I added the postmarkdown gem. I also ran `gem install rdiscount -v '2.0.7.2' in the command line but I'm still receiving this error. Thanks for any help or let me know if you need more info.
you can add ruby "1.9.3" in your gemfile like
source 'https://rubygems.org'
ruby "1.9.3"
and then again bundle install
Try adding ruby version to Gem file
source :rubygems
ruby "1.9.3"
gem 'rails', '3.2.13'
gem 'bootstrap-sass', '2.1'
gem 'google-webfonts'
gem 'postmarkdown'
gem 'rdiscount', "~> 2.0.7.2"
....
ruby 1.9.2 seems to have problem with heroku

Deploy RoR to Heroku and Sqlite3 fails

I've found a number of posts on this same subject (here's one) and thought I made the right changes but I still can't solve the issue.
After completing the bundle install, I push to heroku, I get the following error when it reaches the sqlite3 install.
Installing sqlite3 (1.3.5) with native extensions
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 ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_13nbwv3kitbub/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5 for inspection.
Results logged to /tmp/build_13nbwv3kitbub/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.5), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
To git#heroku.com:morning-dawn-1372.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:morning-dawn-1372.git'
My Gemfile looks like this:
source 'https://rubygems.org'
gem 'rails', '3.2.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'json'
group :development, :test do
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'sqlite3', '1.3.5'
end
# 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'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :production do
gem 'pg', '0.12.2'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
it looks like I have both
Using sqlite3 (1.3.5)
Using sqlite3-ruby (1.3.3)
on my system. Not sure if this is creatign an issue, but explains why I excluded both in the gemfile.
Environmental info:
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-cygwin]
$ rails -v
Rails 3.2.2
Run the bundle command and then make sure that both the Gemfile and Gemfile.lock are checked into the repo before pushing to Heroku.
You will also get this error if sqlite is specified in your Gemfile without a group- for example
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# below is the line that's giving you trouble
gem "sqlite3", "~> 1.3.7"
Heroku does not allow sqlite in production, so you must either delete this line or change this to something like
...
group :development, :test do
gem "sqlite3", "~> 1.3.7", :require => "sqlite3"
end
then do bundle install, then git add and git commit your changes to Gemfile and Gemfile.lock.
After you have done this, your git push heroku master should work.
Try this:
Open the Gemfile.lock and scroll down to sqlite3 (1.3.x) under 'specs:'
Make sure it appears only as sqlite3 (1.3.x) with no extra jazz.
If any extra tags such as "-x86-mingw32" is displayed then delete it.
Run Bundle Install.
Then try pushing Heroku master.
Worked for me.
Edit
Now that I know better, please don't ever change the Gemfile.lock manually.
This was written when I started coding in Rails on Windows.
Try updating the particular gem or lock it to a version in your Gemfile.

Resources