Unable to push a custom gem to heroku master - ruby-on-rails

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.

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 Push Rejected - Cannot find gem multipart-post

I finished setting up OAuth in my app, but I can't seem to push to Heroku. There is a gem dependency that was installed (and everything works locally), but Heroku rejects the push.
I have tried deleted my .lock file, .bundle, and have tried bundle update as well. Heroku will not accept the push
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.5.3
remote: -----> Installing dependencies using bundler 1.15.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.17.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
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: Could not find multipart-post-2.0.0 in any of the sources
remote: Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.17.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
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: Could not find multipart-post-2.0.0 in any of the sources
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
The gem is supposed to be multipart-post (version 2.0.0), but for some reason it is including the version as part of the gem file. Any thoughts?
You can see the RubyGems site & use proper version format such as
gem 'multipart-post', '~> 2.0'
and again commit lifecycle & see what happens

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

Rails error with git push heroku master error

I'm trying to push my git on heroku. For this i use :
$ git push heroku master
return :
remote: --without-sqlite3-lib=${sqlite3-dir}/
remote:
remote:
remote: Gem files will remain installed in /tmp/build_ae596310505cf83afbb45a2986208c96/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.11 for inspection.
remote: Results logged to /tmp/build_ae596310505cf83afbb45a2986208c96/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.11/ext/sqlite3/gem_make.out
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 glacial-taiga-8832.
remote:
To https://git.heroku.com/glacial-taiga-8832.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/glacial-taiga-8832.git'
If i do :
$ sudo gem install sqlite3 -v '1.3.11'
it works but same problem.
Anyone can help?
You need to move the sqlite3 gem into the development section of your Gemfile. Heroku doesn't have the SQLite database installed.
Example:
group :development, :test do
gem 'sqlite3'
end
To use the database on Heroku you need to use PostgreSQL database (by default). To make it work you need to add the pg gem into the production group:
group :production do
gem 'pg'
end
Also, there are some chances that you will need to update your database.yml, but I believe Heroku will just inject their database connection setting in your config file.

Heroku staging enviroment. Failed to install gems via Bundler

I'd like to make staging environment on Heroku, besides production environment. I've prepared stating env as following.
heroku create odai-staging --remote staging
heroku config:add RACK_ENV=staging RAILS_ENV=staging --remote staging
On Gemfile, a group of staging is prepared.
group :production, :staging do
gem 'pg'
gem 'rails_12factor'
end
Then, do as follows.
bundle install
git push staging master
However, I've got following errors. How should I do? I'm looking forward to hearing from you.
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
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: Could not find net-ssh-2.10.0 in any of the sources
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: Could not find net-ssh-2.10.0 in any of the sources
remote: !
remote: ! Failed to install gems via Bundler.
I've solved the problem doing as follows! Thank your for your help!
gem 'net-ssh', '!= 2.10.0'
bundle update

Resources