问题
I was using rails 4.1.7 with ruby 2.0.0 and have developed an application. Recently upgraded to ruby 2.1.4 and made that as "Local" setting using rbenv. Now after doing "gem install rails", everything installed well.
Question is now if I try to run server, i am getting error
"Could not find rake-10.4.0 in any of the sources
Run bundle install to install missing gems."
bundle show rake reveals that its installed under "bundle show rake /Library/Ruby/Gems/2.0.0/gems/rake-10.4.0"
Shouldn't this be under 2.1.4?
回答1:
Use rvm or rbenv to change ruby and gem space to another one. If you will begin usage of the them do the following (NOTE: If you already use one of them, just begin with point 2):
Install rvm with ruby:
$ \curl -sSL https://get.rvm.io | bash -s stable --rubyor install rbenv, and then install ruby, and make it global:
$ \curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash $ rbenv install 2.1.4 $ rbenv global 2.1.4Enter to the project, create two files
.ruby-versionwith just installed version ofruby(in example2.1.4), and.ruby-gemsetwith name of your project:$ cd project-folder $ echo "2.1.4" > .ruby-version $ echo "your-project-name" .ruby-gemsetFix
Gemfilewith newly intsalled version ofrubyadding a line:ruby '2.1.4'Reenter to the project folder, and
rvmwill generate its wrappers:$ cd .. ; cd project-folderIssue gem installation:
$ bundle install
来源:https://stackoverflow.com/questions/27265604/rails-server-not-running-after-updating-to-ruby-2-1-4