简体   繁体   中英

RVM not working on Vagrant

No command 'rvm' found, but there are 21 similar ones rvm: command not found. Comes up when I'm in Vagrant on linux ubuntu 14.04.

Installed Vagrant and VirtualBox.

Found over at rvm command not found


Your problem is that RVM is not loaded when you open a new terminal.

To solve this , run this command line: ( if using login-shell )

echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile

Or this ( if using non-login shell ):

echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc

This will add the path to RVM to load at each Terminal instanciation (close & re-open a terminal after you did this).


You could also try, if you're sshd into your box, running sudo apt-get update and then installing it?

I had this problem as well. I found that I had to add the full path for rvm in the provisioning script. The path is added to the environmental $PATH variable but not known to Vagrant during the provisioning.

/usr/local/rvm/bin/rvm install ruby-2.4.0

After provisioning:

[vagrant@Ruby ~]$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin: \
/usr/local/rvm/bin:/home/vagrant/.local/bin:/home/vagrant/bin

[vagrant@Ruby ~]$ which rvm
/usr/local/rvm/bin/rvm

Another option might be to source /etc/profile before executing an rvm , but I have not tried that yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM