How to fix conflicting requirements installing Nokogiri for Rails on Windows - ruby-on-rails

Recently switched from a Mac to a PC and hit a wall with bundle install.
I get an error but I'm have trouble figuring out what it means and how to fix it. I searched through the GitHub issues and other StackOverflow threads, but none of the fixes suggested help me because they're focused on Linux mostly.
Bundler found conflicting requirements for the Ruby version:
In Gemfile:
Ruby (~> 2.6.5.0)
pg was resolved to 0.21.0, which depends on
Ruby (< 2.5) x64-mingw32
Ruby (< 2.5), which is required by gem 'nokogiri (>= 1.4.1)', is not available
in the local ruby installation

I deleted the Gemfile.lock file which fixed the issue.
The Ruby versions are fine at the project level, I knew this because the server runs on my Mac, so it was a Windows or machine-exclusive issue.

Your version of Ruby is too recent for that project. Downgrade to Ruby 2.4.X or update the gems of the Gemfile.

Related

Rails 6 - Nokogiri LoadError conflict between development and production (x86_64-darwin & x86_64-linux)

When I try deploy using capistrano gem I get:
rake stderr: rake aborted!
LoadError: cannot load such file -- nokogiri/nokogiri
In my Gemfile.lock I can see that nokogiri is installed nokogiri (1.11.2-x86_64-darwin) which is for mac since I'm using mac for development, and when I do gem list in my production which is ubuntu I see nokogiri (1.11.2 x86_64-linux).
Based on one of the answers on SO, I removed -x86_64-darwin from nokogiri (1.11.2-x86_64-darwin) but this gave me:
Downloading nokogiri-1.11.2 revealed dependencies not in the API or the lockfile (mini_portile2 (~> 2.5.0)).
Either installing with `--full-index` or running `bundle update nokogiri` should fix the problem.
I ran bundle update nokogiri with no luck and it only said: Bundler attempted to update nokogiri but its version stayed the same.
I know this issue might happen since the nokogiri in my local is for mac and for development is for Linux.
I'm not sure what I can do to resolve this issue. Any feedback is appreciated.
Rails: 6.1.3
Ruby: 2.5.8
I've faced a similar problem and this helped me.

Gem dependency hell installing redmine with CRM plugins

I was installing a clean Redmine 3.0 with CRM plugin on a fresh install of Ubuntu Server 14.04LTS. I succeeded with redmine and a minor plugin, but the CRM one has hit me with this:
# bundle install --without development test RAILS_ENV=production
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Warning: this Gemfile contains multiple primary sources. Using `source` more
than once without a block is a security risk, and may result in installing
unexpected gems. To resolve this warning, use a block to indicate which gems
should come from the secondary source. To upgrade this warning to an error, run
`bundle config disable_multisource true`.
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "i18n":
In Gemfile:
rails (= 4.2.0) ruby depends on
actionpack (= 4.2.0) ruby depends on
activesupport (= 4.2.0) ruby depends on
i18n (~> 0.7) ruby
money (~> 5.1.0) ruby depends on
i18n (~> 0.6.0) ruby
I installed i18n 0.6.0 and 0.7.0, didn't fix:
# gem list --local | grep i18n
i18n (0.7.0, 0.6.0)
I tried removing the Gemfile.lock and using bundler (bundle update && bundle install) again, same result.
I have no idea how to proceed with this issue. I know very little of ruby, gems and bundler and searching has failed me. Help, please.
You can't use the CRM plugin from redminecrm.com with Redmine 3 right now.
At the time of writing, the plugin is only compatible to Redmine 2.x. While the plugin will probably get updated by the authors, it is not yet compatible with Redmine 3.0.
Generally, you should not expect plugins to magically continue to work across major version updates. Especially when there was a major update recently, many plugins will not yet be compatible to the new Redmine version. If you need the plugins, you might be able to use an older version, e.g. Redmine 2.6, until all the plugins you need are updated.
You always have to check if a plugin is compatible to the Redmine version you intend to use.

Trouble installing gems with bundler

I'm new to Rails, following Michael Hartl's textbook. When I run $ bundle install I get the following error:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.7.6)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
I then try $ gem install bundler which works fine:
Successfully installed bundler-1.7.6
Parsing documentation for bundler-1.7.6
1 gem installed
However, this doesn't solve the problem. I'm sensing this has something to do with version problems, but I'm not sure where to go with it...
The following :
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
means the version of bundler required is greater than or equal to 1.0.0 but strictly less than 1.1.0. Rails 3 is depending on an old version of bundler. At this point of time, you should try out Rails 4 instead :)
You may read up more about the "version syntax" in http://guides.rubygems.org/patterns/#pessimistic_version_constraint
As #user3927334 has already stated the error you got is due to a version conflict between bundler and rails.
Most likely you have run rails new my_app with an outdated version of the rails gem.
gem install rails -v 4.2.0.beta4
Can be used to install a particular version of Rails. see Installing Rails.
You should then remove your old app and rerun the app generator:
rails _4.2.0.beta4_ new hello_app
If you indent to develop on your local machine I would recommend installing RVM (Ruby Version Manager) (as did previous versions of MH's Ruby on Rails Tutorial.)
It allows you to effortlessly switch between different versions of ruby and different sets of gems.

Issue with bundle install using spree from a git clone:

Error message: Bundler could not find compatible versions for gem "spree_core":
*In Gemfile:
spree_paypal_express (>= 0) ruby depends on
spree_core (>= 1.0.0) ruby
spree (= 0.50.2) ruby depends on
spree_core (0.50.2)*
When I do rails --version, I get:
git://github.com/shuber/sortable.git (at master) is not checked out. Please run `bundle install`
Have tinkered with the .bashrc profile as suggested by other StackOverflow posts, 'bundle update' gives the same error message as the first one above.
Mac OS X Lion
Rails 3.0.7
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin11.3.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03
'rvm gem list bundler' returns 1.1.3 and 1.1.3 only, on my working environment with this git clone I have bundler 1.1.3 and 1.0.22.
Thoughts? Not really sure what to do at this point. I tried deleting Gemfile.lock and running bundle install again, but no success.
How are you specifying the spree gem in your Gemfile? The error message seems to say you're specifying one version of 'spree' (possibly =0.50.2), while spree_paypal_express is requiring another version (>= 1.0.0).
I'm not too familiar with bundler, so I can't say for certain. Maybe posting your Gemfile can help us find more leads for you?
Good luck!

Bundler is not self-aware: claims to have version 0.0.1, but is really 1.0.18

EDIT:
I'm an idiot -- I figured out the problem. In a gem I had written a while back, I had VERSION='0.0.1', and for some reason that overrode the version number of bundler.
Won't do that again...
Some background information: on an OS X Lion computer I'm using RVM with Macruby on a Rails 3.0.7 project. I set Macruby and my current gemset to be the default. When I try to run bundle install, I get the following message:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (~> 1.0)
Current Bundler version:
bundler (0.0.1)
Your version of Bundler is older than the one requested by the Gemfile.
Perhaps you need to update Bundler by running `gem install bundler`.
When I run gem list bundle, it shows exactly one installation at version 1.0.18. I suspect that somehow the RVM default setting is not applied all the way through the system. But the system ruby does not have any bundler installed, much less this elusive 0.0.1.
Anybody know what might be going on here?
Could it be possible that your bundle executable is still pointing to an old version of the gem?

Resources