Ruby on Rails RVM $PATH 问题 [英] Ruby on Rails RVM $PATH issue

查看:29
本文介绍了Ruby on Rails RVM $PATH 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 https://rvm.beginrescueend.com/rvm/install/ 安装 ruby​​ (ruby 1.9.2p290) &gems(没问题),然后通过 gem install rails 安装 rails(Rails 3.2.0).但是,当我尝试在我的/user 目录以外的另一个目录中创建一个 rails 应用程序(或发出 rails -v)时,我得到当前未安装程序‘rails’.您可以通过以下方式安装它键入:sudo apt-get install rails"我还注意到,如果我发出 ruby​​ -v 我得到当前未安装程序‘ruby’.您可以通过键入:sudo apt-get install ruby​​".

Used https://rvm.beginrescueend.com/rvm/install/ to install ruby (ruby 1.9.2p290) & gems (no problems), then installed rails via gem install rails (Rails 3.2.0). But when I try and create a rails app (or issue rails -v) in another directory other than my /user directory I get "The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails" I also noticed that if I issue ruby -v I get "The program 'ruby' is currently not installed. You can install it by typing: sudo apt-get install ruby".

显然,这是一个 $PATH 问题,但它已经很长时间,因为我不得不这样做,以至于我完全忘记了如何解决这个问题.我认为这是一个简单的解决方法,但目前我对如何解决这个问题感到有点迟钝.

Obviously, this is a $PATH issue but it's been so long since I've had to do this that I've totally forgotten how to fix the issue. I'm thinking it's a simple fix but I'm feeling borderline retarded at the moment on how to solve this.

再说一次,据我所知,只要我在我的/user 目录中创建一个应用程序或发出命令版本命令......等等,一切顺利.

Again, as far as I can tell, as long as I create an app or issue command version commands...etc..in my /user directory all goes well.

一些可能也有帮助的事情:

A few things that might help as well:

which rails 给了我:/home/j3/.rvm/gems/ruby-1.9.2-p290/bin/rails

which rails gives me: /home/j3/.rvm/gems/ruby-1.9.2-p290/bin/rails

which ruby​​ 给了我:/home/j3/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

which ruby gives me: /home/j3/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

提前致谢,吉姆

推荐答案

似乎您的 rvm 没有正确添加到 PATH(或已损坏).

Seems like your rvm has not been added to PATH properly (or it was broken).

将此行添加到您的配置文件设置(.bashrc 或 .bash_profile)

Add this line to your profile settings (.bashrc or .bash_profile)

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

并获取文件:

source ~/.bashrc  

source ~/.bash_profile

您似乎错误地将 echo 行添加到 .bashrc 中,应该在终端中执行.

You seem to have added the echo line to .bashrc by mistake, it should be executed in terminal.

这篇关于Ruby on Rails RVM $PATH 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆