'rvm use' command seems to have no effect the first time it is run

35 views
Skip to first unread message

Aaron

unread,
Jan 31, 2014, 3:24:58 PM1/31/14
to atlrug-em...@googlegroups.com
It seems that the first time I run ' rvm use' and then try to do something I get an error message about the last gem I installed not being found.
I run 'rvm use' again and then I can use rails fine. Look at the sequence below. Very puzzling. Any suggestions as to why this happens?
 

me@me-VirtualBox:~$ bash -l
me@me-VirtualBox:~$ rvm use 2.0.0@r4
Using /home/me/.rvm/gems/ruby-2.0.0-p353 with gemset r4
me@me-VirtualBox:~$ cd rails_proj/sample_app/
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /home/me/rails_proj/sample_app/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

me@me-VirtualBox:~/rails_proj/sample_app$ rails console
Could not find bcrypt-ruby-3.1.2 in any of the sources   <<<<Why do I get this error?
Run `bundle install` to install missing gems.
me@me-VirtualBox:~/rails_proj/sample_app$ rvm use 2.0.0@r4   <<<I rerun the same command and now it works
Using /home/me/.rvm/gems/ruby-2.0.0-p353 with gemset r4
me@me-VirtualBox:~/rails_proj/sample_app$ rails console
Loading development environment (Rails 4.0.2)   <<<now no error
2.0.0p353 :001 >

Vineel Sonnathi

unread,
Jan 31, 2014, 3:51:41 PM1/31/14
to atlrug-em...@googlegroups.com

You have to be at the root of the project when u use rvm. If you navigate away from root folder, then you have to do rvm again.

--
You received this message because you are subscribed to the Google Groups "Emerald City" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlrug-emeraldc...@googlegroups.com.
To post to this group, send email to atlrug-em...@googlegroups.com.
Visit this group at http://groups.google.com/group/atlrug-emeraldcity.
For more options, visit https://groups.google.com/groups/opt_out.

Jason Noble

unread,
Jan 31, 2014, 5:55:42 PM1/31/14
to Emerald City

Try the following:

echo ‘2.0.0’ > ~/rails_proj/sample_app/.ruby-version
echo ‘r4’ > ~/rails_proj/sample_app/.ruby-gemset

cd ~/rails_proj/sample_app

rvm current             # => Should say 2.0.0@r4

Basically, I think the issue is you told RVM to use the right Ruby and Ruby Gemset, but then you cd’d to a directory.  When you change into a directory, RVM looks for .ruby-version and/or .ruby-gemset and if it finds them uses them to setup RVM for that directory.  If it does not find them, it looks in your Gemfile where you have a ruby 2.0.0 line, and uses that.

Anyone know if you can specify a gemset via the Gemfile?  It’d be nice to not have to create the .ruby-version and .ruby-gemset files all the time…

Jason




Reply all
Reply to author
Forward
0 new messages