问题
I know there's a lot of other questions out there addressing this issue, but I haven't been able to find anything solution that works for me, so I'm posting in case I've missed something.
Using the command-line, when I cd
into a Rails site directory, RVM changes my path by adding "Users/username/bin" to the front of the PATH variable and then it throws a warning about how PATH is not set up correctly because because the ruby gems version isn't in first place in PATH.
Here's my $PATH output prior to changing into a ROR directory:
/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
And after changing the directory into a ROR directory:
/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
I realize that RVM is supposed to change the PATH variable, but why is it adding the "Users/username/bin" to the front?
Here's my .bashrc file:
[[ -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
Here's my .profile file:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
And .bash_profile file:
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*
Things I've tried are:
rvm get stable --auto-dotfiles
rvm get head --auto-dotfiles
rvm use 2.1.1
- removing RVM completely and reinstalling
- removing the Rails site directory and re-cloning from github
- resetting PATH
I've deleted my .profile file and removed the "source ~/.profile" from .bash_profile per 7stud and still the same result (I've closed down iterm and reopened it as well).
.ruby-gemset file:
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
I do not have an .rvmrc file nor a .versions.conf file.
I'm at a complete loss and any help would be appreciated. Thanks in advance.
回答1:
Get rid of your .profile file. Delete it.
Delete the line in .bash_profile:
source ~/.profile
If that doesn't help, please post your Gemfile and the .rvmrc file in your project's directory(if present) and/or .ruby-version, .ruby-gemset, .versions.conf.
Response to comment:
I would try deleting your two files: .ruby-gemset and .ruby-version, then in your Gemfile use these lines:
ruby '2.1.1'
#ruby-gemset=rorproject
They really should do the same thing, but let's see.
来源:https://stackoverflow.com/questions/24960795/rvm-keeps-adding-a-directory-to-my-path-and-then-throws-a-warning-that-path-isn