【问题标题】:ZSH: Command Not Found: railsZSH:找不到命令:rails
【发布时间】:2012-02-28 18:42:07
【问题描述】:

安装了rails...运行gem list rails返回rails (3.2.1)..但是当我运行诸如rails new testapp -T之类的rails命令时,我得到Command Not Found: rails

我正在使用安装到 `~/.rvm/.

的 RVM

在 /bin/bash shell 中该命令可以正常工作,但在 /bin/zsh 中却不行。

我的 .zshrc 文件是:

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="doubleend"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git rails textmate ruby)

source $ZSH/oh-my-zsh.sh

[[ -s "/volumes/MacintoshHD/users/mikedevita/.rvm/scripts/rvm" ]] && source "/volumes/MacintoshHD/users/mikedevita/.rvm/scripts/rvm"

# Customize to your needs...
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/local/git/bin/:/tools

【问题讨论】:

  • 刚刚解决了问题..
  • 对不起,我在点击发送后看到下面的答案加载。很高兴看到你把它修好了。

标签: ruby-on-rails bash zsh


【解决方案1】:

你必须在 ~/.zshrc 中添加它

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

【讨论】:

    【解决方案2】:

    我认为问题就像确保 rvm 的源脚本一样简单:

    [[ -s "/volumes/MacintoshHD/users/mikedevita/.rvm/scripts/rvm" ]] && source "/volumes/MacintoshHD/users/mikedevita/.rvm/scripts/rvm"
    

    zshrc 文件中的最后一行应该可以解决问题,只需将路径的定义移到该行上方,获取 .zshrc 即可。

    【讨论】:

    • 谢谢,效果很好..愚蠢的错误..我会批准一次。
    【解决方案3】:

    您的$PATH 可能不包括安装rails 的位置。在 bash 下查看它的值,并酌情调整。您也许还可以将:$PATH 附加到现有PATH 分配的末尾,并以这种方式获得。

    【讨论】:

    • 由于 RVM 管理这个,他应该只在设置 PATH 后获取 RVM。但基本上你的想法是对的。
    猜你喜欢
    • 2019-11-25
    • 2016-07-30
    • 2015-07-01
    • 2017-08-09
    • 2016-04-12
    • 2016-06-26
    • 2021-12-15
    • 2016-05-15
    相关资源
    最近更新 更多