【问题标题】:Another "PATH is not set up!" error另一个“未设置路径!”错误
【发布时间】:2018-06-21 00:21:38
【问题描述】:

所以我一直潜伏在这里寻找解决问题的方法。我正在尝试通过终端在我的 OSX 上运行 ruby​​ 并安装 gems。我正在尝试设置路径,但在这里遇到了多个问题。当我尝试运行 rvm ls 时,我得到了

Warning! PATH is not properly set up, '/Users/user/.rvm/gems/ruby-2.4.0/bin' is not at first place.
         Usually this is caused by shell initialization files. Search for 'PATH=...' entries.
         You can also re-add RVM to your profile by running: 'rvm get stable --auto-dotfiles'.
         To fix it temporarily in this shell session run: 'rvm use ruby-2.4.0'.
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.

我的 bashrc 文件有

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

还有我的 .bash_profile

    [[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

# Load RVM into a shell session *as a function*

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

当我尝试运行 rvm get stable --auto-dotfiles 时,我得到了这个:

    Adding rvm loading line to /Users/user/.profile /Users/user/.bash_profile /Users/user/.zlogin.
    Installing rvm gem in 2 gemsetsError running 'command gem install /Users/user/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc',
please read /Users/user/.rvm/log/1515684005_ruby-2.4.0/gem.install.rvm->=1.11.3.9.log
Error running 'command gem install /Users/user/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc',
please read /Users/user/.rvm/log/1515684005_ruby-2.4.1/gem.install.rvm->=1.11.3.9.log
.
    Installing gem-wrappers gem in 2 gemsetsError running 'command gem install /Users/user/.rvm/gem-cache/gem-wrappers-1.3.2.gem --local --no-ri --no-rdoc',
please read /Users/user/.rvm/log/1515684005_ruby-2.4.0/gem.install.gem-wrappers->=1.3.2.log
Error running 'command gem install /Users/user/.rvm/gem-cache/gem-wrappers-1.3.2.gem --local --no-ri --no-rdoc',
please read /Users/user/.rvm/log/1515684005_ruby-2.4.1/gem.install.gem-wrappers->=1.3.2.log
.

对不起,如果这是一个非常简单和基本的解决方案,我有一段时间没有搞砸 ruby​​ 或终端/自制软件,所以我迷路了

【问题讨论】:

  • 你能把这个[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*bash_profile中删除,然后把那个留在.bashrc中吗
  • 警告说 rvm 的 bin 应该放在第一位。所以试着把export PATH="$PATH:$HOME/.rvm/bin"改成export PATH="$HOME/.rvm/bin:$PATH"
  • 我都做了,但我仍然得到同样的错误

标签: ruby-on-rails ruby macos terminal rubygems


【解决方案1】:

从你的 .bashrc 文件中删除它:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

【讨论】:

  • 那个也没用,我做了,重启了,还是一样的结果
  • echo $GEM_HOME 将显示您的 gem 的安装位置。问题似乎是 rvm 在您的 PATH 中不是第一个。
猜你喜欢
  • 1970-01-01
  • 2015-01-20
  • 2017-07-14
  • 2014-07-13
  • 1970-01-01
  • 2017-02-23
  • 2013-04-14
  • 2011-12-28
  • 1970-01-01
相关资源
最近更新 更多