更新到 ruby​​ 2.1.4 后 Rails 服务器没有运行 [英] Rails server not running after updating to ruby 2.1.4

查看:38
本文介绍了更新到 ruby​​ 2.1.4 后 Rails 服务器没有运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ruby​​ 2.0.0 中使用 rails 4.1.7 并开发了一个应用程序.最近升级到 ruby​​ 2.1.4 并使用 rbenv 将其设置为本地"设置.现在做了gem install rails"之后,一切都安装好了.

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.

现在的问题是,如果我尝试运行服务器,则会出现错误在任何来源中都找不到 rake-10.4.0运行 bundle install 以安装缺少的 gem."

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 显示它安装在捆绑展示耙/Library/Ruby/Gems/2.0.0/gems/rake-10.4.0"

bundle show rake reveals that its installed under "bundle show rake /Library/Ruby/Gems/2.0.0/gems/rake-10.4.0"

这不应该低于 2.1.4 吗?

Shouldn't this be under 2.1.4?

推荐答案

使用 到将 ruby​​ 和 gem 空间更改为另一个空间.如果您将开始使用它们,请执行以下操作(注意:如果您已经使用其中之一,请从第 2 点开始):

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):

  1. 使用 ruby​​ 安装 rvm:

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

安装rbenv,然后安装ruby,make它是全球性的:

or 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.4

  • 进入项目,创建两个文件 .ruby-version 和刚刚安装的 ruby 版本(例如 2.1.4>),以及带有项目名称的 .ruby-gemset:

  • 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:

    $ cd project-folder
    $ echo "2.1.4" > .ruby-version
    $ echo "your-project-name" .ruby-gemset
    

  • 用新安装的 ruby 版本修复 Gemfile 添加一行:

  • Fix Gemfile with newly intsalled version of ruby adding a line:

    ruby '2.1.4'
    

  • 重新进入项目文件夹,rvm 将生成它的包装器:

    $ cd .. ; cd project-folder
    

  • 问题 gem 安装:

  • Issue gem installation:

    $ bundle install
    

  • 这篇关于更新到 ruby​​ 2.1.4 后 Rails 服务器没有运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆