How to unlock Nokogiri version on Ubuntu - ruby-on-rails

I am trying to install the aws-sdk gem for Rails, but it requires a Nokogiri version less than 1.6.0. I think due to a previous bundle install my system is locked on Nokogiri v1.6.6.2.
I tried removing the locked gem, and ran a bundle update but it didn't work. What should I do?

Specify your desired Nokogiri version in your Gemfile:
gem 'nokogiri', '< 1.6.0'
and run
bundle update nokogiri

Run
gem uninstall nokogiri -v 1.6.6.2
then change the Gemfile to the version you want and then do a bundle install.

Related

bundler version issue in rails 4?

I am getting this bundler error how do i resolve it.
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.2.11.3) was resolved to 4.2.11.3, which depends on
bundler (>= 1.3.0, < 2.0)
Current Bundler version:
bundler (2.3.12)
Your bundle requires a different version of Bundler than the one you're running.
Install the necessary version with `gem install bundler:2.0.0.pre.3` and rerun bundler using `bundle _2.0.0.pre.3_`
What do gem install bundler:2.0.0.pre.3 and bundle _2.0.0.pre.3_ command gonna do. Are they gonna replace my 2.3.12 and install 2.0.0
There can be multiple versions of the same gem installed in your gemset. Run this:
gem install bundler:2.0.0.pre.3
and then run this:
gem info bundler
you will find two versions of the gem installed. By default, it will run bundle with the latest version but as your gems are not compatible with it you can run bundle with a different version of the gem. To do that you need to run:
bundle _version_
in your case it will be:
bundle _2.0.0.pre.3_
You can also remove the other versions of the bundler gem and just keep the one that is compatible. To remove a specific version you could do:
gem uninstall bundler:2.3.12

the therubyracer gem keeps causing bundle install to fail on ubuntu 12.04

I'm trying to use capistrano to deploy, and it fails because of a rubyracer gem issue.
I tried adding the following variants to gemfile and then deploying to a production server on ubuntu and nothing works:
1)
gem 'libv8', '3.11.8.3'
3)
gem 'therubyracer'
gem 'libv8', '3.3.10.4'
4)
gem 'libv8', '~> 3.11.8.3'
It all gives the same error:
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.
So I try this instead:
group :production do
gem 'therubyracer', '0.10.2', :platforms => :ruby
end
But that causes this error:
Bundler could not find compatible versions for gem "libv8":
In Gemfile:
therubyracer (= 0.10.2) ruby depends on
libv8 (~> 3.3.10) ruby
libv8 (3.11.8.3)
It seems I currently have two version of lib8 on server:
libv8 (3.11.8.4, 3.3.10.4 x86_64-linux)
Any ideas?
After hours of trying solutions from stackoverflow, I got an easy fix from this site with just 2 commands, the author mentioned that
When installing therubyracer gem you may run into this problem on a
fresh machine install.
http://usefulprogrammingshit.drmcnasty.com/?p=12
sudo apt-get install g++
sudo apt-get install build-essential
I know nothing of ruby so you would need to research more about this solution, but after all, "therubyracer 0.12.2" is installed on ubuntu 14.04. I hope it could help.
Just uninstall both libv8 from your machine
Terminal
gem uninstall libv8
In terminal, You will be prompt to select which version do you want to uninstall like this:
libv8 3.3.10.4 x86_64-linux
libv8 3.11.8.4 x86_64-linux
All
Select 3 and hit enter(return key). It will uninstall your both libv8 versions installed in your machine.
Now, in your Gemfile just include therubyracer without libv8 and bundle install
gem 'therubyracer'
bundle install
It will work
At the command line of the production server do
gem install therubyracer
try node.js as your runtime javascript environment, but not libv8.
if you insist on libv8, don't specify the version. it seems that there's conflicts on the versions. e.g. in your Gemfile:
gem 'therubyracer'
gem 'libv8'

How to `bundle install` when your Gemfile requires an older version of bundler?

I am in an older Rails project that has a Gemfile. I tried to add a gem to the Gemfile and bundle install but got an error:
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.1.5)
This Gemfile requires a different version of Bundler.
The version of Rails it's using requires bundler ~>1.0.0 but I have 1.1.5 installed and am using it for my other projects. Usually I would use bundle exec ... but since this is bundler we are talking about, it's a little more complicated than that. How can I add a gem to my Gemfile and run bundle install while using the version of bundler that it requires?
First you need to install the appropriate version of bundler:
% gem install bundler -v '~> 1.0.0'
Successfully installed bundler-1.0.22
Then force rubygems to use the version you want (see this post):
% bundle _1.0.22_ install
This is what I had to do to get it to work to install with a previous version (2.2.11) of bundler:
gem install bundler:2.2.11
bundle _2.2.11_ install
The error message In Gemfile: bundler (~> 1.16) is a bit inaccurate, since the version number requirement can come from other places, such as the .gemspec file, which was the case for me:
spec.add_development_dependency "bundler", "~> 1.16"
Removing the version number from the .gemspec file solved the issue for me:
spec.add_development_dependency "bundler"
I had the same issue on macOS Mojave. I installed the different version of the bundler gem and uninstall the current version.
gem install bundler -i '2.0.1'
gem uninstall bundler
Then gives me the option to choose the version to uninstall and I choose the one which is creating the problem.
If you use rvm to manage your ruby versions consider using gemsets for projects. This way you can install the specific version of bundler needed without having to specify the version each time.
You can confirm your gemset is loaded by running rvm info in your project directory.
Now you can install the version of bundler you'd like via gem install bundler -v '~> <VERSION>'. The next time you need to use bundler just run bundle.

bundle install failed

I am getting this error on bundle install
Gem::InstallError: devise_invitable requires RubyGems version ~> 1.3.6. Try 'gem update --system' to update RubyGems itself.
An error occured while installing devise_invitable (0.4.rc), and Bundler cannot continue.
Make sure that `gem install devise_invitable -v '0.4.rc'` succeeds before bundling.
but when i see the version of rubygems i have
gem -v
1.8.10
any ideas on how to fix this....here is the top of my gemfile
gem 'rails', '3.0.3'
gem 'devise', "1.2.rc"
gem 'devise_invitable', '0.4.rc'
In the gemspec for devise_invitable, they explicitly require rubygems, ruby and bundler with specific version constraints. While they look like they should be ok since they are using >=, the fact that it comes out in your console as ~> is telling.
The requirement of ~> 1.3.6 means you need to have a version of rubygems installed that is 1.3.6 <= x < 1.4.0.
You could try running bundle install to get compatible gem versions
But if that doesn't work, try installing the version explicitly gem install rubygems -v 1.3.6

How to force gem version in rails application?

I need to use addressable 2.2.4 gem, but I have 2.2.5 version (because of an issue discussed here: https://github.com/sporkmonger/addressable/pull/33). I tried:
source 'http://rubygems.org'
source 'http://gems.github.com'
gem "addresable", "2.2.4"
bundle install
and get Could not find gem 'adressable (= 2.2.4, runtime)' in any of the gem sources listed in your Gemfile.
If I install/uninstall gem manually by
sudo gem install addressable -v 2.2.4
sudo gem uninstall addressable -v 2.2.5
I get the same error.
So, how can I force 2.2.4 version for my app?
You've misspelled "addressable" in your gem line.
Your bundle might be locked at 2.2.5 — try running bundle update. It's counter-intuitive, but it'll rebuild your Gemfile.lock with the specified version.
You don't need gems.github.com as a source anymore — they quit building it and recommend rubygems.org.

Resources