heroku dependencies fail - ruby-on-rails

I'm trying for the first time to deploy an app to heroku and I'm getting the following error. The list of gems on heroku includes this version of the bson gem, and my gemfile includes source 'http://rubygems.org' at the top. Can anyone suggest why the gem is not being found?
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
Installing rails_log_stdout... done
-----> 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 bson-1.4.1 in any of the sources
FAILED: http://devcenter.heroku.com/articles/bundler
! Heroku push rejected, failed to install gems via Bundler

Looks like the 1.4.1 version of BSON for Ruby was yanked - nothing to do with Heroku.
http://rubygems.org/gems/bson/versions

John's answer was the clue -
gem 'mongoid', '= 2.3.0'
gem 'bson', '= 1.4.0'
gem 'bson_ext', '= 1.4.0'
works for me

Related

Heroku push rejected error: Failed to install gems via Bundler (probably caused by mimemagic)

I try to push my project on heroku and error message pop outs
git push heroku master
remote: -----> Building on the Heroku-18 stack
remote: -----> Using buildpack: heroku/ruby
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.11
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.3
remote: -----> Installing dependencies using bundler 2.2.11
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: Fetching gem metadata from https://rubygems.org/............
remote: **Your bundle is locked to mimemagic (0.3.5), but that version could not be found**
remote: in any of the sources listed in your Gemfile. If you haven't changed sources,
remote: that means the author of mimemagic (0.3.5) has removed it. You'll need to update
remote: your bundle to a version other than mimemagic (0.3.5) that hasn't been removed
remote: in order to install.
remote: Bundler Output: Fetching gem metadata from https://rubygems.org/............
remote: Your bundle is locked to mimemagic (0.3.5), but that version could not be found
remote: in any of the sources listed in your Gemfile. If you haven't changed sources,
remote: that means the author of mimemagic (0.3.5) has removed it. You'll need to update
remote: your bundle to a version other than mimemagic (0.3.5) that hasn't been removed
remote: in order to install.
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: !
I guess the problem is caused by rails gem mimemagic's version is out of date so I try to update to the latest version, it still doesn't work.
Here's my ruby, Rails, mimemagic version
ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
rails -v
Rails 6.1.3.1
bundle info mimemagic
* mimemagic (0.4.3)
information in Gemfile
gem 'rails', '~> 6.1', '>= 6.1.0'
gem 'bundler', '~> 2.2', '>= 2.2.1.1'
gem 'mimemagic', '~> 0.4.3'
in Gemfile.lock
mimemagic (~> 0.4.3)
run bundle update mimemagic worked for me
Change version of mimemagic to 0.3.10 in your Gemfile
Mimemagic seems to be experiencing updates? hopefully will be fixed soon. Try changing mimemagic to previous version for now..
Gemfile:
gem 'mimemagic', '~> 0.3.10'
Running bundle update will automatically update every dependency on your app to the latest version

Heroku Ruby on Rails app push failed

Lately I upgraded my rails app from Rails 3 to Rails 5 and from Bootstrap 2 to Bootstrap 4 and after solving it all I am having some trouble uploading it to Heroku. I mean, in local it works perfectly with rails server. But when I have tried to upload it I get an error and I can't find any similar case on the Internet. This is what I get after git push heroku master:
Counting objects: 122, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (119/119), done.
Writing objects: 100% (122/122), 31.05 KiB | 1.48 MiB/s, done.
Total 122 (delta 77), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: Your app was upgraded to bundler 1.15.2.
remote: Previously you had a successful deploy with bundler 1.5.2.
remote:
remote: If you see problems related to the bundler version please refer to:
remote: https://devcenter.heroku.com/articles/bundler-version
remote: -----> Using Ruby version: ruby-1.9.2
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.15.2
remote: Purging Cache. Changing stack from cedar to cedar-14
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: The latest bundler is 1.16.0, but you are currently running 1.15.2.
remote: To update, run `gem install bundler`
remote: Bundler could not find compatible versions for gem "rubygemsils (= 5.1.4) was resolved to 5.1.4, which depends on
remote: rubygems 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: The latest bundler is 1.16.0, but you are currently running 1.15.2.
remote: To update, run `gem install bundler`
remote: Bundler could not find compatible versions for gem "rubygemsresolved to 5.1.4, which depends on
remote: rubygems ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to keepmefit.
remote:
I know it complains about my bundler version but it should be a warning and not a real error. I guess the problem must be in one of the gems that may not be compatible with Heroku or Rails 5 now but they give no problem on local server. Here's my Gemfile:
source 'https://rubygems.org'
gem 'rails', '5.1.4'
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
group :development, :test do
gem 'sqlite3'
gem 'activemodel'
gem 'json'
gem 'rspec-rails'
gem 'guard-rspec'
gem 'rb-notifu'
end
# Heroku uses PostreSQL
group :production do
gem 'pg'
end
group :test do
gem 'capybara'
gem 'factory_girl_rails', '4.1.0'
gem 'launchy'
end
group :development do
gem 'annotate'
gem 'better_errors'
gem 'binding_of_caller'
gem 'meta_request'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'coffee-script-source', '1.8.0'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
#gem 'bcrypt-ruby'
gem 'bcrypt', '~> 3.1.11', platforms: [:ruby, :x64_mingw, :mingw]
# HTML abstraction language (Haml)
gem 'haml'
gem 'haml-rails'
# Twitter Bootstrap
gem 'bootstrap-sass'
require 'rbconfig'
gem 'wdm', '>= 0.1.0' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
# HMTL 5 support
gem 'modernizr-rails'
# More icons!
#gem "font-awesome-rails"
# http://rubydoc.info/gems/bootstrap-datepicker-rails/1.0.0.7/frames
gem 'bootstrap-datepicker-rails'
gem 'tzinfo-data'
# Sample data
gem 'faker', '1.1.2'
# Pagination
gem 'will_paginate', '~> 3.1.0'
gem 'bootstrap-will_paginate'
# Turbolinks https://github.com/rails/turbolinks#turbolinks
# http://railscasts.com/episodes/390-turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# https://github.com/rails/strong_parameters
# gem 'strong_parameters'
# http://railscasts.com/episodes/314-pretty-urls-with-friendlyid?view=asciicast
gem 'friendly_id'
# http://railscasts.com/episodes/324-passing-data-to-javascript?view=asciicast
gem 'gon'
gem 'cloudinary'
As one of the answers point, I have tried too with git pull heroku master and it returns:
From https://git.heroku.com/keepmefit
* branch master -> FETCH_HEAD
* [new branch] master -> heroku/master
Already up-to-date.
Also git push -f heroku master and the output is the same as using git push heroku master so the error is still there and the push is rejected.
Any help is appreciated.
It seems that the stack (cedar-14 or cedar) is a really old one. Upgrading the stack to Heroku-16 will solve the issue.
It looks like you heroku remote is conflicting with the files you are trying to push (after your upgrade). You have two options
1 - Clean / merge up with your new changes the heroku remote and push again
git pull heroku master
Fix any conflicts / clean up etc..
git push heroku master
2 - Force push your new changes
NOTE: THIS ACTION WILL OVERRIDE WHAT YOU CURRENTLY HAVE IN HEROKU. So make sure that you dont need any changes that are already on heroku.
git push -f heroku master

Heroku, bundler fails on missing dependencies

I have had trouble recently trying to deploy my rails app on Heroku. In the past, I had deployed apps on Heroku with no problem, but Heroku does not support ruby 2.0.0 anymore. They suggest adding ruby "2.2.4" to the Gemfile, which is what I did. The beginning of my Gemfile is as follows:
source 'https://rubygems.org'
ruby "2.2.4"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use pg as the database for Active Record
gem 'pg'
# 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/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
...
So, I have run bundle install with version 1.7.8 on my computer with no problem. I can even run my app in production mode. However, when I try to deploy the app on Heroku, I get this:
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.4
-----> Installing dependencies using bundler 1.11.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.4.2
Installing i18n 0.7.0
Installing minitest 5.4.3
Installing json 1.8.3 with native extensions
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing erubis 2.7.0
Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES
section: 'mini_portile2'
Bundler Output: Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.4.2
Installing i18n 0.7.0
Installing minitest 5.4.3
Installing json 1.8.3 with native extensions
Installing thread_safe 0.3.4
Installing builder 3.2.2
Installing erubis 2.7.0
Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES
section: 'mini_portile2'
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
Any help is greatly appreciated.
I'd suggest deleting your Gemfile.lock, running bundle install again locally, committing the new Gemfile.lock to your git repository and then try your git push heroku master again.
I had the same problem and what I did was I updated Ruby 2.2.4 in my system and restarted terminal, then followed these steps:
bundle install
bundle update
git push heroku
( it’s a good idea to update the gems with bundle update to make sure the versions match)
The problem is that you only changed the Ruby version number in the Gemfile, but did not recreate a valid Gemfile.lock. This leads to a Gemfile.lock that contains Gems in versions that are not compatible with Ruby 2.2.4.
If you change something in the Gemfile then you have to update or recreate the Gemfile.lock with the same Ruby version before pushing to Heroku.
I suggest to use a Ruby version manager (like rbenv or RVM) to be able to run multiple versions of Ruby on your development machine. Then update the Ruby version in your application by changing the Ruby version in Gemfile (for Heroku) and .ruby-version (for your local environment). Both version must match.
Once that is done, run bundle install to update the Gemfile.lock or (when there were major updates or you just want to ensure that you use the latest versions) run bundle update to recreate the Gemfile.lock.

Unable to push a custom gem to heroku master

I have created a simple custom gem in 'gemz' folder and configured in gemfile ('checkpercentage', '~>0.1.0') and it works fine in my application but can't deploy it to heroku.
I'm getting the following error when trying to push my updates into my master branch at Heroku.
my Ruby version:
ruby 2.1.1p76 (2014-02-24 revision 45161) [i686-linux]
Error:
nci#nci-VirtualBox:~/Zacchi/kuizu$ git push heroku master
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using 1.7.12
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote: You have added to the Gemfile:
remote: * source: source at /home/nci/Zacchi/kuizu/gemz
remote: You have deleted from the Gemfile:
remote: * source: source at gemz
remote: Bundler Output: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: You have added to the Gemfile:
remote: * source: source at /home/nci/Zacchi/kuizu/gemz
remote:
remote: You have deleted from the Gemfile:
remote: * source: source at gemz
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to safe-waters-3501.
remote:
Gemfile:
source 'https://rubygems.org'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'devise'
gem 'checkpercentage', '~>0.1.0', :path => "/home/nci/Zacchi/kuizu/gemz"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
.... more gems ...
These are the things I tried to fix this problem but had no luck so far:
bundle install
bundle install --deployment
renamed gemfile.lock then rerun bundle install
Any help is appreciated!
When Heroku "reads" /home/nci/Zacchi/kuizu/gemz (or any other local reference) it doesn't know where to go. You need to publish your gem and remove the local reference from your Gemfile.

Deploy on Heroku failed: Could not find devise-1.4.4 in any of the sources

I follow a deploy article by Getting Started with Heroku.
I tried to deploy my app to heroku. At the beginning I had this problem
-----> 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.4 in any of the sources
FAILED: http://devcenter.heroku.com/articles/bundler
Heroku push rejected, failed to install gems via Bundler
Then I tried some solutions, for example heroku-deploy-cant-find-devise-1-4-6.
I followed these steps
bundle update
git add .
git commit -a "please work"
git push heroku master
but it still have problem.
Here's my Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.9'
gem 'kaminari'
gem "paperclip", "~> 2.4"
gem "devise"
gem 'web-app-theme', '>= 0.6.2'
gem 'gmaps4rails'
gem 'populator'
gem 'mysql2', '~> 0.2.6'
gem 'capistrano'
and Gemfile.lock
...
capistrano-ext (1.2.1)
capistrano (>= 1.0.0)
cocaine (0.2.0)
crack (0.3.1)
devise (1.4.8)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
...
It seem to be good.
But why it still have the same problem.
Could not find devise-1.4.4 in any of the sources
Why my Gemfile.lock uses devise 1.4.8 but it still deploy devise-1.4.4? How do I solve this problem?
Devise 1.4.4 was yanked on RubyGems, you need to use any version greater than 1.4.4.
You don't seem to use 1.4.4 in any source. Make sure to specify a version, otherwise other gems might force bundler to use the yanked version.
# Gemfile
gem "devise", "~> 1.4.8"
Then run
$ bundle update devise
Also, make sure the Gemfile.lock file is stored in your git repository. Otherwise Heroku will try to resolve the dependencies on its own. Commit the changes, then push to Heroku.
try putting in your gemfile
gem "devise", "~> 1.4.4"
and then run bundle install before recommiting
It looks like one of your other gems is requiring devise 1.4.4, which was yanked from rubyforge. Check your gemfile.lock for any other mentions of devise under other gems.
Just to eliminate any other possible funny business, try this in your gemfile:
gem "devise", "1.4.8"
And then running:
bundle update devise
git commit
git push heroku master
I try stupid and complicated method, but work for me.
I git my project into Github before.
So I try my former codes which didn't have FB plugin.(maybe it was rfacebook problem !?)
mkdir test-for-another-sol
cd test-for-another-sol
git init
git pull git#github.com:your_name/your_git.git feature/your_former_project
bundle update devise
git add .
git commit -a "please work"
git push git#heroku.com:your_app_in_heroku.git master
It work!

Resources