【问题标题】:Why I am not able to run Unicorn RoR为什么我无法运行 Unicorn RoR
【发布时间】:2015-12-23 10:08:43
【问题描述】:

我正在尝试使用 Amazon Linux 和 Ansible 在 Amazon EC2 上安装 RoR 服务器。一切都很好,最后我无法运行独角兽。我已经检查了 unicorn gem 是否已安装

`gem list | grep unicorn` 

显示已安装独角兽。

当我输入时

`unicorn_rails` 

我得到命令未找到错误。我检查了我的 gem 文件,它有 gem unicorn 行,然后我运行 bundle install 并且输出在列表中有 unicorn。仍然无法运行它。

谢谢。

【问题讨论】:

    标签: ruby-on-rails unicorn


    【解决方案1】:

    我不确定您是否可以运行 unicorn_rails。只需使用:

    bundle exec unicorn -p <port> -c <path_to_config_file>
    

    例如:

    bundle exec unicorn -p 3000 -c ./config/unicorn.rb
    

    【讨论】:

    • 谢谢,成功了。我以为我可以在命令行上运行 unicorn_rails 。我有点理解捆绑程序的概念,但我认为我也应该能够在命令行上运行。我必须放在我的 ansible playbook 下,我应该在 playbook 中也使用 bundle 吗?那我该如何重启呢?
    • 如果您在 rails 目录中,您实际上可以运行 unicorn,但不能运行 unicorn_rails,因为您只安装了 unicorn
    • 有道理。实际上,unicorn 和 unicorn_rails 都在 bundle exec 下工作。但是,当我在 Rails 应用程序目录中执行 unicorn 时,我仍然收到 command not found 错误。
    【解决方案2】:

    如果您使用 bundler 运行 unicorn 和 bundle exec:

    $ bundle exec unicorn_rails
    

    了解更多here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-15
      • 2012-09-17
      • 2015-03-24
      • 1970-01-01
      • 1970-01-01
      • 2019-11-03
      相关资源
      最近更新 更多