Bundle Install works - but git push heroku master gives errors - heroku

Bundle install worked. But when I git push heroku master, I got this:
C:\Sites\first_app>git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.132' t
list of known hosts.
Counting objects: 65, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (65/65), 26.10 KiB, done.
Total 65 (delta 3), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.2
Running: bundle install --without development:test --path vendor/bun
-binstubs bin/
Fetching gem metadata from https://rubygems.org/.........
Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 3.2.1) ruby depends on
railties (= 3.2.1) ruby
jquery-rails (= 2.0.0) ruby depends on
railties (3.2.3)
Failed to install gems via Bundler.
Heroku push rejected, failed to compile Ruby/rails app
To git#heroku.com:evening-frost-9408.git
[remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:evening-frost-9408.git'
Here is my Gem file:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
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.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.0'
# 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'
I'm basically following Ruby on Rails tutorial. But the rails I have is 3.2.1, but the online book says rails 3.2.3. I tried changing it to 3.2.3 and ~>3.2.3, I still get the same error message
Thanks

I had the same problem, I could not run 'bundle install' and same problem when trying to deploy on heroku (and I'm following the same tutorial).
Found a good answer here: rubygems.org does not serve HTTPS, so change the header of your gemfile from https://rubygems.org to http://rubygems.org.

I had a similar problem and figured I'd add my solution.
Originally my main project was seperated into gems that were included into the main project. As the coupling between the gems and the project increased, it made sense to bring the code for the gems directly into /lib of the main rails project. During the merge, the .gitignore files were merged without any conflicts. Unfortunately, a .gitignore for a gem is very different than for a standalone project. As I proceeded, when I updated a gem locally it would fail on the remote push deploy to Heroku. It turns out the .gitignore from the gem had things like Gemfile.lock and *.gem in it.
TLDR; make sure your .gitignore file is sane

Related

How do I fix a Bundler Conflict when pushing to Heroku?

I'm attempting to deploy a Sinatra app to Heroku. Everything works locally. However I get an issue with bundler when I try to push it successfully to Heroku.
I've tried to delete the Gemfile lock and then the following
bundle update
git add .
git push "Gemfile.lock"
git push heroku master
gem install bundler:2.0.1
bundle install
git add .
git push "Gemfile.lock"
git push heroku master
bundle update --bundler
git add .
git push "Gemfile.lock"
git push heroku master
Here is my gemfile
source "https://rubygems.org"
# gem "rails"
gem 'sinatra'
gem 'activerecord', '~> 5.2', '>= 5.2.2.1'
gem 'rake'
gem 'sinatra-activerecord'
gem 'require_all'
gem 'bcrypt'
gem 'rack-flash3'
gem 'rb-readline'
group :development, :test do
gem 'sqlite3'
gem 'shotgun'
gem 'pry'
end
group :production do
gem 'pg'
end
Here are the error messages
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rack
remote: -----> Using Ruby version: ruby-2.5.5
remote: -----> Installing dependencies using bundler 2.0.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Activating bundler (2.0.1) failed:
remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_77505ef74596fc4dddd66c8b792d759b/Gemfile.lock.
remote: To update to the latest version installed on your system, run `bundle update --bundler`.
remote: To install the missing version, run `gem install bundler:2.0.1`
remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
remote:
remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote: Bundler Output: Activating bundler (2.0.1) failed:
remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_77505ef74596fc4dddd66c8b792d759b/Gemfile.lock.
remote: To update to the latest version installed on your system, run `bundle update --bundler`.
remote: To install the missing version, run `gem install bundler:2.0.1`
remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.0', execute `gem env` for more information
remote:
remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to infinite-waters-69714.
remote:
To https://git.heroku.com/infinite-waters-69714.git
! [remote rejected] master -> master (pre-receive hook declined)
Additionally, I've tried to remove sqlite3 altogether and repeat the above processes.
Any ideas on how to fix this?
I've ran into this issue some time ago: I contacted Heroku and they told me they have a locked version of Bundler, so your only option is to use the Bundler version they use:
gem uninstall bundler
gem install bundler -v 2.0.2
bundle update

Application Error : Heroku, Ruby on Rails 4, warnings: rails_12factor, vendor/bundle, no Procfile

My Ruby on Rails 4 application works well on Mac.
But when I tried to upload my application to Heroku, with the warning messages, the Heroku application hasn't worked, saying application error in the corresponding web page.
Here I put a log file including very mysterious terms such as rails_12factor and procfile:
remote: ###### WARNING:
remote: Include 'rails_12factor' gem to enable all platform features
remote: See https://devcenter.heroku.com/articles/rails-integration-gems for more information.
remote:
remote: ###### WARNING:
remote: Removing `vendor/bundle`.
remote: Checking in `vendor/bundle` is not supported. Please remove this directory
remote: and add it to your .gitignore. To vendor your gems with Bundler, use
remote: `bundle pack` instead.
remote:
remote: ###### WARNING:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby '2.0.0'
remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.
remote:
remote: ###### WARNING:
remote: No Procfile detected, using the default web server (webrick)
remote: https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for Ruby -> console, rake, web, worker
remote:
remote: -----> Compressing... done, 30.0MB
remote: -----> Launching... done, v6
remote: https://ringlebeta.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
And this this my Gemfile! I would love to hear any suggestions and opinions:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# 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
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
# 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
#Google Auth
gem "omniauth-google-oauth2", "~> 0.2.1"
# 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'
gem 'sqlite3'
end
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
"Gemfile" 54L, 1596C
Add this to your Gemfile, then try deploying:
source 'https://rubygems.org'
# ...
# Your Gemfile contents here
# ...
group :production do
gem 'pg' # If you plan to use PostgreSQL in your Heroku app
gem 'rails_12factor'
end
The rails_12factor is a gem provided by Heroku. It enables serving assets in production and setting your logger to standard out, both of which are needed to run a Rails app on a 12-factor provider.
Heroku integration has previously relied on using the Rails plugin system, which has been removed from Rails 4. To enable features such as static asset serving and logging on Heroku please add rails_12factor gem to your Gemfile.
At the end of Gemfile add:
gem 'rails_12factor', group: :production
Then run:
bundle install and then try deploying:
Try creating the Procfile in the root directory. Inside the Procfile add the following line: web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

bundler no longer vendoring gem

I have a gem that is a reference to a private repo that I use. I reference it in my gem file like this:
gem 'google', git: 'git#github.com:radiumsoftware/google.git'
and in my Gemfile.lock the dependency looks like this:
GIT
remote: git#github.com:radiumsoftware/google.git
revision: dff0e3dcddbfd74967b3a0f954922fd3592b5101
specs:
google (0.3.0)
activesupport
faraday (~> 0.8.0)
faraday_middleware
mail-xoauth
multi_json
nokogiri
The gem had previously been vendoring, that is it was in my vendor/cache.
I updated the repo for this Gem and changed to the revision to the new commit but after running bundle install or even bundle update, the gem had moved from vendor/cache to the rvm gems folder.
Can anyone explain why? I am running:
bundler 1.6.2
ruby 2.0.0p353
Run bundle package --all to include git (and path) gems in vendor/cache.
http://bundler.io/man/bundle-package.1.html#GIT-AND-PATH-GEMS

BUNDLE_WITHOUT is not applied when deploying app on Heroku

My goal is to deploy an app on Heroku for the environment 'heroku_production'.
My Gemfile looks like this:
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
...
I set the BUNDLE_WITHOUT variable to "development:test:production". Here is the output when calling 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
But when I push my stuff to Heroku the BUNDLE_WITHOUT var is not applied as you can see in the following error message (line 3: --without development:test):
-----> 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 git#heroku.com:my_app.git
! [remote rejected] 3dac67374c268d3bf9e051a6db39efc56ae81c76 -> master (pre-receive hook declined)
Why is Heroku doing that?
Googling didn't help as well.
Please note - for the time being, the Cedar stack does not support BUNDLE_WITHOUT.
From: https://devcenter.heroku.com/articles/bundler#specifying-gems-and-groups
I recently contacted Heroku about this issue, and they say that BUNDLE_WITHOUT now works!
Here's the response I got:
Hi,
user_env_compile is deprecated, but the functionality of this just became default for the Ruby buildpack - so you can use BUNDLE_WITHOUT config var.
I believe that you saw this article, but is that correct? https://devcenter.heroku.com/articles/bundler#specifying-gems-and-groups
Seems like we need to update that document!
Best,
[name redacted]
Haven't tried it yet but will soon.

Heroku Deploy can't find devise-1.4.6

Trying to deploy to Heroku but get the following error:
-----> Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
Fetching source index for http://rubygems.org/
Could not find devise-1.4.6 in any of the sources
FAILED: http(preventing hyperlink)://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler
I have "gem 'devise'" in my gem file, have "source 'http://rubygems.org'" at the top, and have run both bundle install and bundle update. Not sure why Heroku is looking for 1.4.6. Any ideas?
Thanks!
John
Here is the gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.9'
gem 'devise'
gem 'sqlite3', '1.3.3', :group => :development
Looks like devise 1.4.6 is no longer at Rubygems.com: http://rubygems.org/gems/devise/versions
I tried using devise 1.4.5, but it didn't work either.
You need to update the locked version of Devise in your Gemfile.lock.
$ bundle update devise
Then commit, push and deploy to Heroku.

Resources