在Ubuntu 12.04上使用RVM来使用Rails.当前未安装程序"rails" [英] Using RVM on Ubuntu 12.04 to use Rails. The program 'rails' is currently not installed

查看:94
本文介绍了在Ubuntu 12.04上使用RVM来使用Rails.当前未安装程序"rails"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照官方网站上的安装指南从头开始安装RVM.我安装了Rails,创建了一个虚拟应用,一切正常.

I installed RVM from scratch following the installation guide on the official website. I installed Rails, created a dummy app and everything worked fine.

我关闭了机器.

第二天早上,我再次打开计算机(冷启动),并尝试从控制台运行"rails -v",但是出现以下错误消息:

The next morning, I turned on the machine again (cold boot) and the tried running "rails -v" from the console, but I get the following error message:

sergio @ Sergio-work〜$ rails -v

sergio@Sergio-work ~ $ rails -v

程序"rails"当前不是 已安装.您可以通过键入以下命令进行安装:sudo apt-get install rails

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

我可以很好地运行ruby -v,并获得以下消息:

I can run ruby -v just fine, and get the following message:

sergio @ Sergio-work〜$ ruby​​ -v

sergio@Sergio-work ~ $ ruby -v

红宝石1.9.3p194(2012-04-20修订版35410)[x86_64-linux]

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

我也可以很好地运行gem list,输出:

I can also run gem list just fine, output:

sergio@Sergio-work ~ $ gem list

*** LOCAL GEMS ***

actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.4)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
faraday (0.8.0)
google_drive (0.3.0)
hike (1.2.1)
httpauth (0.1)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.2)
json (1.7.3)
libv8 (3.3.10.4 x86_64-linux)
mail (2.4.4)
mime-types (1.18)
multi_json (1.3.6, 1.3.5)
multipart-post (1.1.5)
mysql2 (0.3.11)
nokogiri (1.5.0)
oauth (0.4.6)
oauth2 (0.7.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (0.9.2.2)
rdoc (3.12)
rubygems-bundler (1.0.2)
rvm (1.11.3.3)
sass (3.1.19, 3.1.18)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.4)

为什么我的rails -v命令不再起作用?我曾经遇到过这种"hack",在此之前我需要在终端"source something something"中运行一次命令,然后才能将rails识别"为实际命令.每个终端我必须这样做一次,这意味着如果我关闭一个终端,则必须在打开新的窗口终端后重新运行它.

Why doesn't my rails -v command work anymore? I used to have this "hack" where I would need to run a command in terminal, "source something something" once, before rails would be "recognized" as an actual command. I had to this once per terminal, meaning if I closed a terminal I had to re-run this after opening a new window terminal.

我似乎再也找不到RVM的帮助"部分(我最初在哪里找到)的命令,并且由于我是Linux的新手,所以这些高级配置对我来说很复杂.

I can't seem to find this command anymore on the Help section for RVM (where I originally found it) and since I'm kind of new to Linux, these advanced configurations are complex to me.

有什么想法吗?

推荐答案

在尝试使用Rails之前,您需要输入source ~/.rvm/scripts/rvm.

You need to type source ~/.rvm/scripts/rvm before attempting to use Rails.

我相信RVM安装建议将此行(或类似内容)放入您的.bashrc.

I believe the RVM installation suggests putting this line (or something similar) in your .bashrc.

在终端中运行以下命令:

Run the following command in Terminal:

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

这会将source \$HOME/.rvm/scripts/rvm行添加到.bashrc文件的末尾.

This appends the line source \$HOME/.rvm/scripts/rvm to the end of the .bashrc file.

这样做可以确保每次打开终端时都能正确加载RVM.

Doing so ensures that RVM is properly loaded each time you open up a terminal.

这篇关于在Ubuntu 12.04上使用RVM来使用Rails.当前未安装程序"rails"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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