RVM不断向我的PATH添加一个目录,然后抛出一条警告,指出PATH没有正确设置

时间:2014-07-25 16:59:54

标签: ruby bash rvm command-line-interface

我知道还有很多其他问题可以解决这个问题,但是我找不到任何适用于我的解决方案,所以我发帖以防我错过了什么。

使用命令行,当我cd进入Rails站点目录时,RVM通过在PATH变量的前面添加“Users / username / bin”来改变我的路径,然后它会发出警告PATH设置不正确,因为ruby gems版本不在PATH的第一位。

这是在更改为ROR目录之前的$ PATH输出:

/Users/username/.rvm/gems/ruby-2.1.1/bin:/Users/username/.rvm/gems/ruby- 2.1.1@global/bin:/Users/username/.rvm/rubies/ruby2.1.1/bin:/Users/username/.nvm/v0.10.18/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki:/Users/username/.rvm/bin:/Users/username/.rvm/bin

将目录更改为ROR目录后:

/Users/username/bin:/Users/username/.rvm/gems/ruby-2.1.1@rorproject/bin:/Users/username/.rvm/gems/ruby-2.1.1@global/bin:/Users/username/.rvm/rubies/ruby-2.1.1/bin:/Users/username/.rvm/bin:/Users/username/.nvm/v0.10.18/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki

我意识到RVM应该改变PATH变量,但为什么要在前面添加“Users / username / bin”?

这是我的.bashrc文件:

[[ -s /Users/username/.nvm/nvm.sh ]] && . /Users/username/.nvm/nvm.sh # This loads NVM

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

这是我的.profile文件:

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

和.bash_profile文件:

source ~/.profile

if [ -f ~/.bashrc ]; then
  source ~/.bashrc
fi

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

我尝试过的事情是:

  • rvm get stable --auto-dotfiles
  • rvm get head --auto-dotfiles
  • rvm use 2.1.1
  • 完全删除RVM并重新安装
  • 删除Rails站点目录并从github重新克隆
  • 重置路径

我删除了我的.profile文件并从.bash_profile每7stud删除了“source~ / .profile”,结果仍然相同(我关闭了iterm并重新打开了它)。

.ruby-gemset文件:

rorproject

.ruby-version file:

2.1.1

的Gemfile

source 'https://rubygems.org'
source 'http://rails-assets.org'

gem 'rails', '~> 4.0.0'
gem 'mysql2'
gem 'unicorn-rails'
gem "active_model_serializers", "~> 0.8.0"
gem 'foreman'
gem 'sorcery', github: 'NoamB/sorcery'
gem 'cancan'
gem 'date_validator', github: 'codegram/date_validator'
gem 'oj'                  # faster json handling
#gem 'oj_mimic_json'       # for OJ integration w/ ROR 4.1+
gem 'rails-patch-json-encode' # for OJ integration w/ ROR < 4.1
gem 'acts-as-taggable-on'
gem 'haml-rails'          # Used by the frontend app, via grunt, and for PDF generation
gem 'will_paginate'
gem 'paper_trail', '~> 3.0.1'
gem 'state_machine'

gem 'sprockets-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'

# Attachment handling
gem 'carrierwave'
gem 'fog'
gem 'mime-types'
gem 'aws-sdk'
gem 'unf'
gem 'mini_magick'

# PDF Calendars
gem 'wkhtmltopdf-binary'
gem 'wicked_pdf'

# Excel output
gem 'axlsx_rails'

# Exception reporting
gem "sentry-raven"

# Soft deletes
gem 'paranoia', '~> 2.0'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use debugger
group :development, :test do
  gem 'debugger'
  gem 'rspec-rails', '~> 2.0'
  gem 'spork-rails', :github => 'sporkrb/spork-rails'

  gem 'guard'
  gem 'guard-bundler'
  gem 'guard-rspec'
  gem 'guard-spork'
  gem 'guard-process'
  gem 'guard-migrate', :github => 'glanotte/guard-migrate'

  gem 'quiet_assets'
  gem 'factory_girl_rails', :require => false
  gem 'faker'
end

group :development do
  gem 'factory_girl_rails'  # Do the require in dev, so rails generators can make factories
end

group :test do
  gem 'database_cleaner'

  gem 'simplecov',      :require => false
  gem 'simplecov-rcov', :require => false
end

我没有.rvmrc文件,也没有.versions.conf文件。

我完全失去了任何帮助,我们将不胜感激。提前谢谢。

1 个答案:

答案 0 :(得分:0)

  1. 删除.profile文件。删除它。

  2. 删除.bash_profile中的行:source ~/.profile

  3. 如果这没有用,请将您的Gemfile和.rvmrc文件发布到项目目录(如果有)和/或.ruby-version,.ruby-gemset,.versions.conf。

    对评论的回应:

    我会尝试删除你的两个文件:.ruby-gemset和.ruby-version,然后在你的Gemfile中使用这些行:

    ruby '2.1.1'
    #ruby-gemset=rorproject
    

    他们真的应该做同样的事情,但让我们看看。