rails尚未安装 的解决方法

来源:互联网 发布:淘宝客app制作教程 编辑:程序博客网 时间:2024/06/09 08:55

按照淘宝Ruby的rails安装指南和RubyChina的Rails环境配置指南配置好了Rails环境,可第二天突然抽风,找不到rails bundle等命令

不可能啊,第一次安还测试过安对了,东找西找,两大种解释,环境变量和环境变量 RubyChina的问题讨论

可是为什么第一次是好的呢?

哦,终于发现一篇有用的文章了,看来找问题还是得去官网啊

rvm官网解答 shell --> 编辑 --> 配置文件首选项 --> 标题和命令 --> 勾选以登陆shell方式运行命令


解释在此:

What shell login means ('bash -l')

There are sites that describe this how it was 10 years ago like here orhere so read to see how it works in current world:

  1. When you login graphically to your system it will read `~/.profile` so you put there settings like `LANG` which are important for graphical applications
  2. When you open a terminal (except Gnome-terminal & Screen) you open a `login` shell which sources `~/.bash_profile`
  3. When you execute commands in non login shell like `ssh server command` or `scp file server:~` or `sudo`(without -i) or `su` (without -l) it will execute `~/.bashrc`

`~/.bashrc` is meant for non login invocations, you should not print there any output - it makes tools like `scp` to fail

it is good idea to put environment variables in `~/.bashrc`, things that you depend upon in your scripts (for `ssh server script`)

then if your system does not source `~/.bashrc` by default via `/etc/profile` you should source it in `~/.bash_profile` file so any login shell will have access also to the same environment like non login sessions.

RVM by default adds itself currently to `~/.bash_profile` file, and the recommended way is to enable login shell in gnome-terminal (and screen).