简体   繁体   English

RVM在Vagrant上不起作用

[英]RVM not working on Vagrant

No command 'rvm' found, but there are 21 similar ones rvm: command not found. 找不到命令“ rvm”,但是有21个类似的rvm:命令未找到。 Comes up when I'm in Vagrant on linux ubuntu 14.04. 当我在Linux ubuntu 14.04上处于Vagrant时出现。

Installed Vagrant and VirtualBox. 安装了Vagrant和VirtualBox。

Found over at rvm command not found rvm命令中找不到


Your problem is that RVM is not loaded when you open a new terminal. 您的问题是打开新终端时未加载RVM。

To solve this , run this command line: ( if using login-shell ) 要解决此问题 ,请运行以下命令行:( 如果使用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). 这将添加到RVM的路径以在每个终端实例上加载(完成此操作后关闭并重新打开终端)。


You could also try, if you're sshd into your box, running sudo apt-get update and then installing it? 如果您将sshd放入框中,也可以尝试运行sudo apt-get update然后安装它?

I had this problem as well. 我也有这个问题。 I found that I had to add the full path for rvm in the provisioning script. 我发现必须在配置脚本中添加rvm的完整路径。 The path is added to the environmental $PATH variable but not known to Vagrant during the provisioning. 路径已添加到环境$ PATH变量中,但在配置期间Vagrant未知。

/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. 另一个选择可能是在执行rvm之前先获取source /etc/profilervm ,但是我还没有尝试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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