I have an existing rails app in Heroku and I'm trying to push it there but it gives me this error everytime I try to push to Heroku
There was an error parsing your Gemfile, we cannot continue
remote: ! /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
remote: ! from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
remote: ! from /tmp/d20190617-88-bonyg7/bundler-2.0.1/bin/bundle:23:in `<main>'
From there, what I think stands out the most are:
There was an error parsing your Gemfile, we cannot continue
can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
My Gemfile.lock states that my app is bundled with 2.0.2
When I do gem list, bundler part gives me this bundler (default: 2.0.2, default: 1.17.2)
Any help is appreciated! Thanks!
EDIT:
Here is my Gemfile
source 'https://rubygems.org'
ruby '2.6.3'
gem 'bootsnap', require: false
gem 'devise'
gem 'jbuilder', '~> 2.0'
gem 'pg', '~> 0.21'
gem 'puma'
gem 'rails', '5.2.3'
gem 'redis'
gem 'autoprefixer-rails'
gem 'font-awesome-sass', '~> 5.6.1'
gem 'sassc-rails'
gem 'simple_form'
gem 'uglifier'
gem 'webpacker'
gem 'bundler'
gem 'material-sass', '4.1.1'
gem 'cloudinary'
gem 'carrierwave'
group :development do
gem 'web-console', '>= 3.3.0'
end
group :development, :test do
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'dotenv-rails'
end
The issue here is that Heroku is unable to use the bundle that you are requesting him to use. You can fix it with many solutions while you request Heroku to use a bundle they know (As I know, 2.0.2 does not work).
Opening your Gemfile.lock and at the end of the file replace
BUNDLED WITH
2.0.2
with
BUNDLED WITH
2.0.1
To fix the issue on the long term you can just gem uninstall bundler and then run gem install bundler -v 2.0.1
Related
I was trying to bundle install, but I keep on getting this error message.
My attempt was to update the version of ruby. However, this did not work. I also researched the compatible version of activerecord that corresponds to ruby version 2.2.5., but I was not able to find any.
I would truly appreciate it if you could resolve this error.
Here below is my gemfile for reference:
ruby '2.2.5'
source 'https://rubygems.org'
gem 'sinatra', '~> 2.1'
gem 'sinatra-contrib', '~> 2.1'
gem 'webrick', '~> 1.7'
gem 'sinatra-activerecord', '~> 2.0'
gem 'activerecord', '~> 6.1'
gem 'pg', '~> 1.2'
gem 'rake', '~> 13.0'
gem 'bcrypt'
gem 'sinatra-flash'
group :development do
gem 'debase'
gem 'fastri'
gem 'rcodetools'
gem 'rubocop'
gem 'ruby-debug-ide'
end
Reinstalling updated ruby version worked:
rvm reinstall ruby-2.6.3
bundle install
I am using
gem 'axlsx_rails'
gem 'acts_as_xlsx'
for downloading file into excel.
Now I am trying to add the following gem
gem 'caracal'
for downloading file into docx.
Whenever, I am trying to run
bundle install, I got the following error
Bundler could not find compatible versions for gem "rubyzip": In
snapshot (Gemfile.lock):
rubyzip (= 1.0.0)
In Gemfile:
acts_as_xlsx was resolved to 1.0.6, which depends on
axlsx (>= 1.0.13) was resolved to 2.0.1, which depends on
rubyzip (~> 1.0.0)
caracal was resolved to 0.1.0, which depends on
rubyzip (~> 1.1)
Running bundle update will rebuild your snapshot from scratch, using
only the gems in your Gemfile, which may resolve the conflict.
My gem file looks like following
source 'https://rubygems.org'
gem 'rails', '4.1.9'
gem 'mysql2', '~> 0.3.19'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'devise'
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'capistrano', '~> 3.4.1'
gem 'capistrano-rails'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
end
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails', '3.2.0'
gem 'cancan'
gem 'carrierwave', github: 'carrierwaveuploader/carrierwave'
gem 'rmagick'
gem 'caracal'
gem 'activerecord-session_store', github:
'rails/activerecord-session_store'
gem 'carmen-rails', '~> 1.0.0'
gem 'wicked'
gem 'figaro'
gem 'bootstrap-datepicker-rails'
gem 'axlsx_rails'
gem 'acts_as_xlsx'
I have solved the problem by adding
gem 'axlsx', '~> 2.1.0.pre'
in the gem file. This gives an error first then I had to update rubyzip. After that I run
bundle install
The axlsx_rails gem hasn't been updated for quite a while and it depends on a version of the axlsx gem that depends on a 1.0.x version of the rubyzip. Whereas caracal depends on a version >= 1.1. That said: Current versions of that gem will not work together.
But an even older version of the axlsx 1.3.6 had a more relaxed dependency to the rubyzip gem - it only requires its version to be >= 0.9.5.
Therefore I suggest - if possible - to downgrade axlsx_rails to 0.1.2 and try again:
# add a version to the axlsx_rails gem in your Gemfile
gem 'axlsx_rails', '0.1.2'
And run bundle install again.
I'm following the instruction on the Rails Tutorial Chapter 3. When running the command line bundle install --without production I'm getting:
Bundler could not find compatible versions for gem "sprockets-rails":
In snapshot (Gemfile.lock):
sprockets-rails (2.1.3)
In Gemfile:
sass-rails (= 4.0.1) ruby depends on
sprockets-rails (~> 2.0.0) ruby
Running bundle update will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
When running bundle update I'm getting:
An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
When I run gem install nokogiri -v '1.6.2.1' it complains:
Building native extensions. This could take a while... Building
nokogiri using packaged libraries. ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/yotamros/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb Building
nokogiri using packaged libraries. ----- libiconv is missing. please
visit nokogiri.org/tutorials/installing_nokogiri.html for help with
installing dependencies. ----- * extconf.rb failed *
This is my Gemfile:
source 'https://rubygems.org'
ruby '2.1.2'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.1.1'
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
Any help would be much appreciated.
I found the solution that worked for me here (by Claudio Poli):
brew reinstall libiconv libxml2 libxslt
gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/
Try bumping sass-rails to '~> 4.0.3' in your Gemfile. You have it locked to a specific slightly out of date version. For what it's worth, a brand new Rails 4.1.1 project has these gems:
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
(I would have put this in a comment but I'm not that cool yet.)
When I run bundle install in my Rails 4 application I get the following error:
An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
I'm using rvm and when I run gem install nokogiri -v '1.6.1' it works well. Moreover, when I run gem list I see nokogiri 1.6.1 installed, it's just that bundle install in my app does not work.
By the way, it's happening only when I add the impressionist gem to my Gemfile, but I guess it's just a dependency.
More info: I have followed, just in case, the instructions here, and everything worked well.
Any ideas? TIA
EDIT 1: The full error is:
Installing nokogiri (1.6.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/sonxurxo/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
/Users/sonxurxo/.rvm/rubies/ruby-1.9.3-p448/bin/ruby: invalid option -P (-h will show valid options) (RuntimeError)
Gem files will remain installed in /Users/sonxurxo/Documents/workspace/Smart Promo/RubyOnRails/vendor/bundle/gems/nokogiri-1.6.1 for inspection.
Results logged to /Users/sonxurxo/Documents/workspace/Smart Promo/RubyOnRails/vendor/bundle/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
EDIT 2: I'm on Mac OS X Mavericks, with XCode and developer tools successfully installed
EDIT 3: My Gemfile:
source 'https://rubygems.org'
# gem 'rails', '3.2.1'
gem 'rails', '4.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'authlogic'
gem 'acl9'
gem 'recaptcha'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem "paperclip", ">= 3.4.1"
gem 'kaminari'
gem 'activerecord-session_store'
gem 'rpush'
gem 'mysql2'
gem 'twitter'
gem 'gmaps4rails'
gem 'gon'
gem 'flexslider'
gem 'jquery-ui-rails'
gem "breadcrumbs_on_rails"
gem "jquery-fileupload-rails"
gem 'gettext_i18n_rails'
gem 'gettext', '>=3.0.2', :require => false, :group => :development
gem 'thinking-sphinx'
gem 'delayed_job_active_record'
gem 'daemons'
gem 'ts-delayed-delta', '~> 2.0.0', :require => 'thinking_sphinx/deltas/delayed_delta'
gem 'geocoder'
gem 'i18n'
gem 'globalize', '~> 4.0.0'
gem 'batch_translations'
gem 'countries'
gem 'country_select'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
end
gem 'jquery-rails'
gem 'impressionist'
EDIT 4: Output for gem list nokogiri:
*** LOCAL GEMS ***
nokogiri (1.6.1, 1.5.9)
I think I solved this.
I say think because it seems to be related with a misconfiguration concerning rvm and bundler.
bundler was installing my gems in vendor/bundle, and not using those from the rvm gemset. What I did was to tell bundler to use those gems from rvm, and then, since nokogiri was already installed, it worked.
Thank everyone for your comments and answers.
Impressionist has the following dependency:
s.add_dependency 'nokogiri', '~> 1.5'
Do you need the latest version of nokogiri or can you live with this version as well?
With 'bundle install --deployment' it won't work if you are below a directory with spaces in its name. Replacing the spaces with underscores fixed a similar problem for me. See https://github.com/bundler/bundler/issues/3020
I am receiving an error while bundle install my updates. Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'libv8'
gem 'therubyracer'
gem 'haml'
gem 'haml-rails'
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'compass-rails'
gem 'chosen-rails'
gem "bootstrap-wysihtml5-rails", "~> 0.3.1.10"
gem 'hpricot'
gem "rest-open-uri", "~> 1.0.0"
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
gem "commonjs", "~> 0.2.6"
gem "less", "~> 2.2.2"
gem "less-rails", "~> 2.2.6"
end
gem 'jquery-rails'
gem 'simple_form'
gem 'client_side_validations'
gem 'client_side_validations-simple_form'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
Here is an error i am getting after running bundle install command on production:
An error occured while installing therubyracer (0.11.0), and Bundler
cannot continue. Make sure that gem install therubyracer -v '0.11.0'
succeeds before bundling.
I did the following that worked for me:
I commented out therubyracer from my Gemfile
ran "bundle install"
installed the newest version of therubyracer using "gem install therubyracer" (at the time of writing this is 0.11.2)
I uncommented therubyracer to put it back in to my Gemfile
ran "bundle install" again and everything works
Including libv8 in the Gemfile seems to be a fix to that:
gem 'libv8', '~> 3.11.8.3'
via https://github.com/cowboyd/therubyracer/issues/215
I did a gem uninstall therubyracer & gem uninstall libv8, then remove libv8 from the gemfile and just use therubyracer, then run 'bundle install'
group :assets do
gem 'therubyracer'
end
If it still does not work, just try to intall NodeJS
probably, your libv8 version and therubyracer version are not matching.
So, either you can include proper libv8 version in the Gemfile, which is similar to the
jibiel's solution
gem 'libv8', '~> 3.11.8.3'
But, I would prefer to do these two steps, So, that you don't have to worry about finding proper version of libv8:
Gemfile
gem 'therubyracer'
terminal
gem uninstall libv8
bundle install
And, that is what I have done to solve my same problem