简体   繁体   中英

RVM Ruby version

I've just deinstalled ruby version 2.1.0 via rvm to get rid of the message "your current ruby version is 2.1.0 but your gemfile specifies 2.0.0" but when I now try to run rails s I get the following error:

-bash: /Users/myname/.rvm/gems/ruby-2.0.0-p353/bin/rails: /Users/myname/.rvm/rubies/ruby-2.1.0/bin/ruby: bad interpreter: No such file or directory

Where could this ruby-2.1.0 version be specified? I've looked at the ~/.bash_profile , which looks like this:

PATH="/Users/myname/.apportable/SDK/bin:$PATH"

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

And the ~/.bashrc which looks like this:

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

But I can't find any of the versions. Maybe something is wrong with the content of these files? I wasn't able to find any good tutorial about this specific topic. Thanks.

Update: Here is the gemfile:

source 'https://rubygems.org'

ruby '2.0.0'

gem 'rails', '3.2.13'

gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem "therubyracer"
gem "less-rails" 
gem "twitter-bootstrap-rails"

# Use jquery as the JavaScript library

gem 'jquery-rails', '2.2.1'
gem 'devise'
gem 'rails-i18n'

# pdf
gem 'prawn'

# charts
gem "google_visualr", ">= 2.1"

gem 'json'

group :development do
    gem 'sqlite3'
end

group :production do
gem 'pg'
gem 'uglifier'
  gem 'newrelic_rpm'
end

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier'
  gem 'therubyracer'
end

Here is the output of rvm list

rvm rubies

   ruby-1.9.2-p320 [ x86_64 ]
   ruby-1.9.3-p0 [ x86_64 ]
   ruby-1.9.3-p392 [ x86_64 ]
   ruby-1.9.3-p448 [ x86_64 ]
   ruby-2.0.0-p0 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
=* ruby-2.0.0-p353 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

ruby -v returns ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]

Update 3 rvm reload shows:

Warning! PATH is not properly set up, '/Users/myname/.rvm/gems/ruby-2.0.0-p353/bin' is not at first place,
         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-p353'.

Update 4 This is the output for

rvm get head
rvm 2.0.0,2.0.0@global do rvm gemset reset_env

Warning! PATH is not properly set up, '/Users/myname/.rvm/gems/ruby-2.0.0-p353/bin' is not at first place,
         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-p353'.
Downloading https://get.rvm.io
Downloading https://github.com/wayneeseguin/rvm/archive/master.tar.gz

Upgrading the RVM installation in /Users/myname/.rvm/
    RVM PATH line found in /Users/myname/.profile /Users/myname/.zshrc.
    RVM PATH line not found for Bash, run the installer with '--auto-dotfiles' to fix it.
    RVM sourcing line found in /Users/myname/.bash_profile /Users/myname/.zlogin.
Upgrade of RVM in /Users/myname/.rvm/ is complete.

# myName,
#
#   Thank you for using RVM!
#   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.

In case of problems: http://rvm.io/help and https://twitter.com/rvm_io

Upgrade Notes:


  * WARNING: You have '~/.profile' file, you might want to load it,
    to do that add the following line to '/Users/nikolajandersen/.bash_profile':

      source ~/.profile

  * It looks like some old stuff is laying around RVM, you can cleanup with: rvm cleanup all

  * No new notes to display.

RVM reloaded!
Nikolajs-iMac-3:ergowerkstatt myname $ rvm 2.0.0,2.0.0@global do rvm gemset reset_env
gem gem-wrappers >=1.2.4 is already installed
gem gem-wrappers >=1.2.4 is already installed
Nikolajs-iMac-3:ergowerkstatt myname $ 

Thanks you very much to everyone who helped me on this. I finally "fixed" this issue somehow, after the following steps:

  • installed ruby 2.1.0 again
  • removed it again
  • removed 2.0.0
  • reinstalled 2.0.0
  • brew doctor

Finally after these steps everything worked properly. Really weird.

run:

rvm get head
rvm 2.0.0,2.0.0@global do rvm gemset reset_env

it will update RVM to latest version and reset environment/wrapper files for both default and global gemsets for ruby 2.0.0 , this should solve your problem, if it does not then you might be hitting a new bug, please open a bug here then: https://github.com/wayneeseguin/rvm/issues

Do 'which ruby' on terminal. On my system, there was a symlink in '/usr/bin'. Could also be in '/usr/sbin'. Correct it to point to the correct path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM