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.
Related
I am facing a mysql2 gem version error while trying to create a new RailsApps example application using Rails Composer. For example, while creating a rails-devise-roles example with the following command:
$ rails new rails-devise-roles -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
The error is:
Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
The messages on the console indicate mysql2 version 0.3.21 is pulled in
run bundle install --without production from "."
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
...................
Using mysql2 0.3.21
The generated Gemfile has
gem 'mysql2', '~> 0.3.18'
I am using ruby 2.5.3 and Rails 5.2.1
I am not able to run bundle update devise or bundle install
$ bundle update devise
Fetching gem metadata from http://rubygems.org/.............
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies............
Fetching rake 12.3.0 (was 10.1.0)
Installing rake 12.3.0 (was 10.1.0)
Gem::RuntimeRequirementNotMetError: rake requires Ruby version >= 2.0.0. The current ruby version is 1.9.1.
An error occurred while installing rake (12.3.0), and Bundler cannot continue.
Make sure that `gem install rake -v '12.3.0'` succeeds before bundling.
and this is what I am getting on $ bundle install
Fetching gem metadata from http://rubygems.org/.............
Fetching gem metadata from http://rubygems.org/..
You have requested:
devise = 2.2.4
The bundle currently has devise locked at 3.1.0.
Try running `bundle update devise`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`
Thanks in advance
From the log trace given it seems like you have specified the version 2.2.4 in gemfile for devise.
Just remove the version from gemfile and then run bundle update, rubygems will itself find the dependent gem version based on the ruby version and lock it the gemfile.lock.
The problem being that your Devise Gem is locked to a particular version which is the problem. If you check your gemfile.lock you will see its fixed.
Changing version in a Gemfile will not affect which gem version is loaded. bundle install / bundle update is actually needed.
Example of how you can go about that is in the Devise Gem documentation.
Change your gemfile to gem 'devise' and run bundle install rubygems will itself find the dependent gem version based on the ruby version and lock it to the gemfile.lock.
I am setting up redmine with turnkey redmine appliance 12.0. I got following error after
executing command bundle install -v 1.0.0
root#redmine www/redmine# bundle update
The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Updating git://github.com/rails/prototype_legacy_helper.git
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Fetching gem metadata from http://rubygems.org/..
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.3.4)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
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
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!