【问题标题】:Rails not working after updating Ubuntu from 10.04 to 14.04将 Ubuntu 从 10.04 更新到 14.04 后 Rails 无法正常工作
【发布时间】:2014-11-15 00:31:39
【问题描述】:

我在 Ubuntu 10.04 中安装了 Rails。并启动并运行了一些应用程序。但是在将 Ubuntu 更新到 14.04 后,rails 应用程序无法运行。

当我尝试启动我的 Rails 应用程序(作为 $rails 服务器)时,收到以下警告和帮助:

bin/rails:6: warning: already initialized constant APP_PATH
/home/razor/rails_projs/simple_cms/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
         (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
         new application called MyApp in "./my_app"

In addition to those, there are:
 application  Generate the Rails application code
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 plugin new   Generates skeleton for developing a Rails plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.

【问题讨论】:

  • 在将 ubuntu 更新到 14.04 时,它询问我是否要删除一些过时的软件包。并选择是,这有关系吗?

标签: ruby-on-rails-4 updates ubuntu-14.04


【解决方案1】:

This link,帮我解决了这个问题。 我不得不卸载 mysql2 gem 然后重新安装。

我使用的命令

$gem uninstall mysql2
$gem install mysql2

一切都很好,可以启动服务器了。

【讨论】:

    【解决方案2】:

    当我错误地尝试从 app 目录外部并再次从 gem/engine 目录内部运行 rails server 时,我发生了这种情况。你能确认你在你的主应用程序中吗?如果您的应用名称是 simple_cms,看起来您就是。

    如果是这样,那么你运行时会得到什么

    type rails
    

    which rails
    

    奇怪的是,它为您提供了从应用程序中创建应用程序的选项,这是不可能的。你安装了哪个版本的rails?

    【讨论】:

    • 是的,我正在从我的应用程序内部运行 rails 服务器。命令的输出如下: $type rails rails is hashed (/home/razor/.rvm/gems/ruby-2.1.2/bin/rails) $which rails /home/razor/.rvm/gems/ruby-2.1.2/bin/rails
    • 你也可以给我rails版本吗?我认为命令是 rails -v 以及您的应用程序正在使用的 rails 版本。您是否也可以尝试创建一个新的 rails 应用程序并在其中运行 rails 服务器。
    • Rails 版本:4.1.6 尝试使用新应用程序,即使结果相同。
    猜你喜欢
    • 2019-08-10
    • 1970-01-01
    • 2017-05-23
    • 1970-01-01
    • 2016-02-09
    • 2012-12-19
    • 2017-07-04
    • 2013-05-28
    • 2014-05-29
    相关资源
    最近更新 更多