Ruby on Rails RVM $PATH 问题

发布于 2024-12-29 08:57:54 字数 932 浏览 1 评论 0原文

我使用 https://rvm.beginrescueend.com/rvm/install/ 安装 ruby (红宝石 1.9.2p290) gems(没问题),然后通过gem安装rails安装rails(Rails 3.2.0),但是当我尝试创建rails应用程序(或发出rails -v)时在 /user 目录以外的另一个目录中,我得到:

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

我还注意到,如果我发出 ruby​​ -v ,我得到:

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

显然,这是一个 $PATH 问题,但自从我发布以来已经很久了我必须这样做我完全忘记了如何解决这个问题。

据我所知,只要我在 /user 目录中创建应用程序或发出命令版本命令,一切都会顺利。

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

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

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

I 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

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.

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

A few things that might help as well:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦罢 2025-01-05 08:57:54

似乎您的 rvm 尚未正确添加到 PATH(或者已损坏)。

将此行添加到您的配置文件设置(.bashrc 或 .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,它应该在终端中执行。

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

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*

and source the file:

source ~/.bashrc  

or

source ~/.bash_profile

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

放飞的风筝 2025-01-05 08:57:54

当您尝试在所在目录中创建新的 Rails 应用程序时,请务必输入 rvm use {ruby version} 并且您还可以使用 rvm use --default 设置默认值{ruby version} 每当加载新终端时都使用该 rvm 版本的 ruby​​。

When you try to create a new rails app in whichever directory you are in, be sure to type rvm use {ruby version} and you can also set a default by using rvm use --default {ruby version} to use that rvm version of ruby whenever you load a new terminal up.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文