Search code examples
rubyrubygemslinux-mint

How do I get the "bundle install" command to only look at the current version of "ruby" (which I chose)?


I installed Ruby (v2.6.3) and Rails (v5.2.3).

Even completed a training project on this framework. Then he took up a working project and first of all executed the command bundle install. All modules were delivered normally, except one "sassc-2.0.1"

Installation fails with this error:

sassc-2.0.1 requires ruby version >= 2.3.3, which is incompatible with the current version, ruby 2.3.1p112

That is, I chose one version, and in fact uses a different version. I can't understand the reason for this.

But I didn't give up the first time. I tried to check the ruby version in different ways:

(1) Get ruby version

$> ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

(2) Get path to bin for ruby

$> which ruby
/home/vdenisov/.rvm/rubies/ruby-2.6.3/bin/ruby

(3) Get path to bin for bundle

$> which bundle
/home/vdenisov/.rvm/rubies/ruby-2.6.3/bin/bundle

All these commands give out that the current version of ruby is 2.6.3

However, my friend advised me to do one more check

(4) WTF ???

$> /usr/bin/ruby -v
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

P.S.: before that I programmed in nodejs and there is a version Manager "nvm" - when you run the command "nvm use a.b.c" in the system, always use the nodejs version of "a.b.c" (the same I expected from the "rvm").


Solution

  • /usr/bin/ruby -v gives you the version of ruby installed in your operating system.

    It seems that you already run rvm use --default 2.6.3 because your ruby points to rvm location.

    Ruby environment manager RVM supports configuration inside following files: .rvmrc, .versions.conf, .ruby-version, Gemfile. More here: https://rvm.io/workflow/projects

    Check these files, it's good practice to set ruby version inside .ruby-version or Gemfile.