【问题标题】:Why do I get a PATH error when sourcing RVM?为什么在采购 RVM 时会出现 PATH 错误?
【发布时间】:2013-08-21 11:18:28
【问题描述】:

在启动终端或使用 RVM 时,我不断收到此错误。我已尝试删除 PATH,但仍然一无所获。

cat: /Users/admin/.rvm/VERSION: No such file or directory
    Warning! PATH is not properly set up, '/Users/admin/.rvm/gems/ruby-2.0.0-p247/bin' is not available,
             usually this is caused by shell initialization files - check them for 'PATH=...' entries,
             it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
             to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p247'.
    -bash: /Users/admin/.rvm/scripts/base: No such file or directory
    -bash: /Users/admin/.rvm/scripts/help: No such file or directory

我的 ~/.bash_profile,为简洁而编辑:

source ~/.rvm/scripts/rvm

PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

【问题讨论】:

    标签: macos path terminal rvm environment-variables


    【解决方案1】:

    你正在破坏你的路径

    您需要在任何 PATH 自定义之后获取 RVM,或者您只是破坏了 RVM 设置的值。目前,您正在采购 RVM,然后覆盖它创建的修改后的 PATH。根据您的启动文件配置,以下行应放在您的~/.bashrc~/.profile~/.bash_profile 的最后:

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

    除非您知道自己在做什么,否则不要在采购 RVM 后修改您的 PATH。即使这样,您仍需要确保将新 PATH 附加或预先添加到当前 PATH。例如,您可以在采购 RVM 后放置如下内容:

    PATH=$HOME/foo/bar:$PATH
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多