could not find compatible versions for gem "rubyzip" - ruby-on-rails

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.

Related

Errors when doing Bundle Update

I updated my ruby to 3.0.0 but for some reason now my application doesn't work. I have searched online for different answered but I cannot find anything. This error has gotten me going crazy now. Here is what happens.
When I do bundle update I get:
Bundler could not find compatible versions for gem "ruby":
In Gemfile:
ruby (~> 3.0.0)
thredded (~> 0.16.13) was resolved to 0.16.16, which depends on
ruby (~> 2.3)
I looked online and someone said to do bundle update rails but when I do I get this error:
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
active_model_serializers was resolved to 0.10.10, which depends on
activemodel (>= 4.1, < 6.1)
challonge-api was resolved to 0.2.0, which depends on
activeresource was resolved to 5.1.0, which depends on
activemodel-serializers-xml (~> 1.0) was resolved to 1.0.2, which
depends on
activemodel (> 5.x)
challonge-api was resolved to 0.2.0, which depends on
activeresource was resolved to 5.1.0, which depends on
activemodel (>= 5.0, < 7)
carrierwave was resolved to 2.0.2, which depends on
activemodel (>= 5.0.0)
rails (= 6.1.2.1) was resolved to 6.1.2.1, which depends on
activemodel (= 6.1.2.1)
Any ideas what I need to do?
Here is my gem file:
source 'https://rubygems.org'
ruby '~> 3.0.0'
Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '6.1.2.1'
Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.0'
Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'merit', '= 3.0.1'
Used to implement at.js for auto complete mentions/emojis
gem 'jquery-atwho-rails'
Use twitter bootstrap sass
gem 'bootstrap-sass', '~> 3.4.0'
gem 'autoprefixer-rails'
gem 'font-awesome-rails'
gem 'font-awesome5-rails', '~> 1.0', '>= 1.0.1'
gem 'font_awesome5_rails'
gem 'xbox_live_api'
gem 'faraday'
gem 'oj'
gem 'thredded', '~> 0.16.13'
gem 'rails-ujs'
group :development do
gem 'spring'
gem 'letter_opener'
gem 'guard'
gem 'guard-rspec', '~> 4.2.8'
gem 'byebug'
end
group :development, :test do
gem 'puma'
gem 'sqlite3', '~> 1.3.6'
end
group :production do
gem 'pg', '~>0.18'
gem 'unicorn'
gem 'cloudinary'
gem 'rails_12factor'
gem 'fog'
gem 'fog-aws'
end
gem 'devise'
gem 'carrierwave'
gem 'friendly_id', '~> 5.0'
gem 'will_paginate', '~> 3.1.0'
gem 'public_activity'
gem 'acts_as_votable', '~> 0.10.0'
gem 'acts_as_commentable'
gem 'acts_as_follower'
gem 'counter_culture', '~> 0.1.33'
gem 'faker'
gem 'populator'
gem 'auto_html', '~>1.6.4'
gem 'sanitize'
gem 'active_model_serializers'
gem 'private_pub'
gem 'thin'
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
Use debugger
gem 'debugger', group: [:development, :test]
gem 'round_robin_tournament'
gem 'tournament-system', '~> 2'
gem 'challonge-api'
gem 'tournament'
gem 'oauth2'
gem 'activerecord-session_store'
gem "simple_calendar", "~> 2.0"
Currently Ruby 3.0 is not supported with Rails, as there will be next release for Rails. You can do following and it works by installing dev branch of ruby 3. I used ruby 3.1.0dev (2021-02-14T05:09:08Z master ff527e7e32) [x86_64-darwin19] Following commands are with RVM you can use same with other softwares I tried by installing
rvm install ruby-head
This command installed version ruby 3.1.0dev Now install rails
gem install rails
Now create new project
rails new test_rails
now run it using rails s' if you are getting error that ruby version 3.1.0 required is because rails has added this in .ruby-version` so it is just warning no issue. You can try latest version but as I said it is dev version not stable. Note ruby-head will keep changing version of ruby installed as it is latest version. And good news it is blazing fast! I love it.
I suggest use ruby 2.7.2 with rails 6 till new release comes, the above is for test purpose only, not production or actual product. You should use ruby 2.7.2 for production or product.

Adding Spree to your Rails Application

I am following the spree Documentation at guides.spreecommerce.org
But I am getting an error:
Could not find gem 'spree (~> 3.1.0) x86-mingw32' in any of the gem sources listed in your Gemfile.
Run bundle install to install missing gems.
Actually your gem file has specified rails 5 so you need to try this
gem 'spree', '~> 3.3.0'
gem 'spree_auth_devise', '~> 3.3'
gem 'spree_gateway', '~> 3.3'

Why do I get an error when I bundle install a bootstrap-sass gem?

Resolving dependencies...
Bundler could not find compatible versions for gem "sass":
In Gemfile:
bootstrap-sass (~> 3.3.6) x86-mingw32 depends on
sass (>= 3.3.4) x86-mingw32
sass-rails (>= 3.2) x86-mingw32 depends on
sass (3.2.19)
source 'https://rubygems.org'
gem 'rails', '4.1.8'
gem 'sqlite3'
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 'bootstrap-sass'
group :doc do
gem 'sdoc', '~> 0.4.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin]
You don't show your other gems so I can't be sure, but I suspect you've got another gem there that requires the sass-rails gem to be at version 4.0.3 (or at least at a higher version than 3.3.6.) Since you've locked sass-rails at an earlier version, the dependent gem can't find what it needs.
If this is a new Rails app, I suggest reverting your sass-rails gem back to 4.0.3.
Is there any reason why you want an earlier version?

spree : theme installation

I just set up spree successfully but want to add a new theme into it.
I chose that one :
https://github.com/dbwinger/spree_serenity_theme
But when I try a "bundle install", I get the following message :
Bundler could not find compatible versions for gem "spree_core":
In snapshot (Gemfile.lock):
spree_core (= 3.0.4)
In Gemfile:
spree_core (= 3.0.4) ruby
spree_core (~> 3.0.0) ruby
spree_core (~> 3.0.0) ruby
spree_fancy (>= 0) ruby depends on
spree_core (~> 2.3.0.beta) ruby
Running `bundle update` will rebuild your snapshot from scratch,
using only the gems in your Gemfile, which may resolve the conflict.
Any Idea to fix this issue ?
Ruby : 2.2.2p95
Rails : 4.2.2
Gemfile :
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem 'mysql2', '~> 0.3.18'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
gem 'spree', '3.0.4'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
gem 'spree_serenity_theme', :git => 'https://github.com/dbwinger/spree_serenity_theme.git'
Thanks for your help
The Gem spree_serenity_theme is compatible with spree version 2 and not with spree version 3.
Check the dependencies of the gem https://github.com/dbwinger/spree_serenity_theme/blob/master/spree_serenity_theme.gemspec
That's why it is not working.
The current version of spree core is 3.0.4, You will have to install spree from 2-0 stable branch of the spree and not from the master branch.
https://github.com/spree/spree/tree/2-0-stable
You can create a fork of the theme and make changes according to your requirement for the latest version of spree
Thank you

Unable to install bundle

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.)

Resources