【问题标题】:Ruby on rails project deploy to serverRuby on rails 项目部署到服务器
【发布时间】:2016-09-07 16:27:48
【问题描述】:

我有一个 ruby​​ on rails 项目。它使用命令“rails s”在我的 PC 上成功运行。所以我决定使用 Capistrano 将它部署到 AWS。服务器端,我使用的是 Puma + Nginx + mysql 堆栈。 (我正在关注本指南:https://www.sitepoint.com/deploy-your-rails-app-to-aws/

我在运行“cap production deploy”时出错:

Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy2@111.21.5.197: rake exit status: 1
rake stdout: rake aborted!
Sass::SyntaxError: Invalid CSS after "...e bootstrap.min": expected "{", was ""
(sass):6648

我发现是文件 app/assets/stylesheets/application.css 导致了错误。在这个文件中,我只有一行:

*= require bootstrap.min

我认为这是正确的。因为该应用程序可以在我的 PC 上运行。 如果删除此行,则运行“cap production deploy”时不会出错。该应用程序可以部署到服务器并在服务器上运行。但是所有网页都没有CSS。我基本上是 ruby​​ on rails 的新手。所以我不知道所有这些文件之后的细节。有没有人可以建议我应该怎么做才能使我的应用成功部署到服务器?

【问题讨论】:

    标签: ruby-on-rails amazon-web-services capistrano


    【解决方案1】:

    将您的样式表重命名为 application.scss(注意 scss 扩展名)并确保它包含以下行:

    //= require bootstrap.min
    

    【讨论】:

    • 非常感谢。这行得通。我花了几天时间在谷歌上搜索解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-26
    • 2013-07-28
    • 2015-04-07
    • 2015-07-28
    • 2017-10-12
    • 2023-03-31
    • 1970-01-01
    相关资源
    最近更新 更多