简体   繁体   English

更新到Ruby 2.1.4后,Rails服务器未运行

[英]Rails server not running after updating to ruby 2.1.4

I was using rails 4.1.7 with ruby 2.0.0 and have developed an application. 我在ruby 2.0.0中使用Rails 4.1.7,并开发了一个应用程序。 Recently upgraded to ruby 2.1.4 and made that as "Local" setting using rbenv. 最近升级到ruby 2.1.4,并使用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." 现在的问题是,如果我尝试运行服务器,我将收到错误消息“在任何来源中都无法找到rake-10.4.0。运行bundle install以安装缺少的gems。”

bundle show rake reveals that its installed under "bundle show rake /Library/Ruby/Gems/2.0.0/gems/rake-10.4.0" bundle show rake显示其安装在“ bundle show rake /Library/Ruby/Gems/2.0.0/gems/rake-10.4.0”下

Shouldn't this be under 2.1.4? 这不应该低于2.1.4吗?

Use or 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): 如果您将开始使用它们,请执行以下操作( :如果您已经使用了其中之一,则从第2点开始):

  1. Install rvm with ruby: 用ruby 安装rvm

     $ \\curl -sSL https://get.rvm.io | bash -s stable --ruby 

    or install rbenv , and then install ruby, and make it global: 安装rbenv ,然后安装ruby并将其设置为全局:

     $ \\curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash $ rbenv install 2.1.4 $ rbenv global 2.1.4 
  2. Enter to the project, create two files .ruby-version with just installed version of ruby (in example 2.1.4 ), and .ruby-gemset with name of your project: 进入项目,创建两个文件.ruby-version ,它们是刚刚安装的ruby版本(在示例2.1.4 ),以及.ruby-gemset和项目名称:

     $ cd project-folder $ echo "2.1.4" > .ruby-version $ echo "your-project-name" .ruby-gemset 
  3. Fix Gemfile with newly intsalled version of ruby adding a line: 使用新安装的ruby版本修复Gemfile并添加一行:

     ruby '2.1.4' 
  4. Reenter to the project folder, and rvm will generate its wrappers: 重新进入项目文件夹, rvm将生成其包装器:

     $ cd .. ; cd project-folder 
  5. Issue gem installation: 发行gem安装:

     $ bundle install 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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