bundle install against an older version of ruby for one gem - ruby

I can install the linecache (0.46) gem against ruby v 1.8.x, but not 2.0.0. When I run bundle install, I want to specify that I want to install all gems against 2.0.0 except linecache, which I want to install against 2.0.0. How can I do that?

I ended up just installing using an older version of ruby for all the gems. I used rvm use "ree-1.8.7-2012.02" and bundle install, and that worked.

Related

Installing Ruby on Rails latest version matching Ruby 3.0

When I try the following, after installing Ruby 3.0 from snap on Ubuntu 18.04::
gem install rails
I get this error:
/snap/ruby/201/lib/ruby/3.0.0/x86_64-linux/rbconfig.rb:13:in `<module:RbConfig>': ruby lib version (3.0.0) doesn't match executable version (2.5.1) (RuntimeError)
It was right after using
rails new rest-api-messages --api --database=postgresql
and trying to install PostGRES
gem install pg -v '1.2.3' --source 'https://rubygems.org/'
How could I solve this? is Ruby on Rails only for version 2.5.1 and lower?
edit: Then I got
Can't find the 'libpq-fe.h header when trying to install pg gem
Solved with
sudo apt-get install libpq-dev
Duplicate from Can't find the 'libpq-fe.h header when trying to install pg gem
My guess is you already had Ruby 2.5 installed and they are stepping on each other. Ruby versions don't overwrite each other. You need to uninstall Ruby 3.0 and 2.5 and install a Ruby version manager then install Ruby using it. This will also give you a path to move forward easily. Check out Ruby version manager like rbenv or RVM. Take a look at both. For what it's worth. I have used both and finally settled on rbenv.

Bundler could not find compatible versions for gem "bundler", but gem list does not have the version that it says is installed

I'm using rbenv, ruby 2.6.5, and attempting to use bundler 2.0.2. Currently when I run gem list, bundler 2.0.2 is the only version shown on the screen. However, when I run bundle install in my project, an error is thrown stating that my current bundler version is 2.1.2. If I run bundler version in the shell, it indeed says 2.1.2. Where can I find this version and eliminate it?
Thanks,
Ed
Uninstall all versions of bundler with gem uninstall bundler and install the version you need again.

Bundler version for Ruby 2.3.8?

I currently have 2 ruby versions, 2.5.5 and 2.3.8, I am managing them with rbenv, and for gems, I use bundler to manage my specific gem versions. I have an issue when I want to switch to a project that uses 2.3.8 or a version that has to do with Ruby version 2.3.
My question is how do I get bundler to run the command to bundle install interact with my 2.3 projects.
My current version of bundler is 2.0.2.
I have already tried installing a lower version of bundler of which the bundler website claims to interact with ruby version 2.3.
I thought that if I specified the command to run bundle _version_ install it would work, but it still gave me the response that it needed ruby version 2.5 for bundler to work.
Lots of help appreciated.
In some situations, isolation can help. I would like to recommend rvm (https://github.com/rvm/rvm) for managing ruby versions. This tool is very similar to rbenv but in comparison, it allows you to create gemsets which are kind of containers of gems for special purposes. For instance:
rvm install 2.5.5 --disable-binary
rvm use 2.5.5#name-of-gemset --create
gem install bundler
bundle install # inside your project folder with Gemfile
I think that you will not have problems with versions again.

Best way to upgrade to Ruby 2.3 through rvm while keeping all your gems?

What's the best way to upgrade to Ruby 2.3 through rvm while keeping all your gems installed on previous version (e.g. json, nokogiri, etc)?
EDIT
This question has an answer here: RVM: How to use gems from a different ruby?
$ rvm gemset copy $oldversion 2.3.0 ## Assign or replace $oldversion with old version name
ORIGINAL
Before installing Ruby 2.3, get a list of your installed gems and their versions using gem list. Then, after you install Ruby 2.3, use rvm to set 2.3 as the new default:
$ rvm install 2.3.0
$ rvm --default use 2.3.0
If you use Bundler, gem install bundler and then bundle install in all your project directories. This should install all of the gems relevant to your work.
If you don't use Bundler, or if you have gems installed that aren't part of any project's Gemfile, then you will want to go through the list of gems and their versions that you made earlier and gem install each of them, using -v to specify the version.

bundler does not install gem in current rvm gemset if gem is from remote repository

I have selected a gemset with
rvm use ruby-2.1.2#deploy
in my gemfile I have:
gem 'transip', :git => 'git://github.com/rempargo/transip.git'
then I run bundle install and get the following output:
....
....
Installing wasabi 3.3.0
Installing savon 2.5.1
Using transip 0.4.2 from git://github.com/rempargo/transip.git (at master)
Using bundler 1.6.2
Your bundle is updated!
But when I do gem list all gems except the transip one are listed.
The other gems are not installed in gemset 'ruby-2.1.2' or 'ruby-2.1.2#global', but are really installed in the gemset ruby-2.1.2#deploy
I tried also to use bundle exec install although I never used the 'exec' before, but it does not work.
Is there a problem using bundler and rvm when using gems that uses a link to a repository?
I'm using:
Mac OS X 10.9.3 (With command-line tools installed)
rvm 1.25.26
bundler 1,6,2
P.S. This all happened after upgrading to Maverick, when some libraries where not working anymore, and I had to install ruby again with rvm.
gem list will show all the gems installed on your system
bundle show gem_namewill give you whether that gem is installed in your current application bundled gemset

Resources