简体   繁体   English

无法使用rvm安装从命令行运行rails

[英]Cannot run rails from command line with rvm installation

I have just made a fresh install of rvm with rails on a fresh Linux Mint machine 我刚刚在新的Linux Mint机器上用rails重新安装了rvm
I can see that rails is installed in my gems 我可以看到我的宝石中安装了rails

gem query --local

*** LOCAL GEMS ***

...other stuff ...
rails (3.2.8)
...other stuff ...

but if I try to run from console I cannot see it 但如果我尝试从控制台运行,我看不到它

$ rails -v
The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails

this is my PATH variable 这是我的PATH变量

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/motta/.rvm/bin

what should I add to the path to have rails available? 我应该在路径中添加哪些轨道? thank you 谢谢

UPDATE: This is the output of rvm list 更新:这是rvm列表的输出

rvm rubies

=* ruby-1.9.3-p286 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

The installation has been done following the rvm instructions 安装已按照rvm说明进行
https://rvm.io/rvm/install/ https://rvm.io/rvm/install/

SOLVED: When I finished the installation I found out that rvm modified my /home/user/.bashrc file with this line 已解决:当我完成安装后,我发现rvm使用此行修改了我的/home/user/.bashrc文件

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

therefore I thought that the following one was not needed anymore, which is not the case 因此我认为不再需要以下一个,但事实并非如此

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

adding the one above to .bashrc solved my problem 将上面的一个添加到.bashrc解决了我的问题

Your PATH is obviously set wrong, make sure you use ruby: 您的PATH显然设置错误,请确保使用ruby:

rvm use 1.9.3

To make this persistent for next sessions set the default: 要使此持久性为下一个会话设置默认值:

rvm use 1.9.3 --default        #OR:
rvm alias create default 1.9.3

Finally you might need to enable login shell to make it working (there are few answers on this topic already). 最后,您可能需要启用登录shell才能使其正常工作(此主题的答案很少)。

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

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