【问题标题】:Heroku Rails 5 LoadError: Could not load the 'listen' gemHeroku Rails 5 LoadError:无法加载“听”宝石
【发布时间】:2017-05-23 21:25:26
【问题描述】:

我是 Heroku 的新手,并且一直遵循 Getting Started guide 的信函。但是,当我使用 git push heroku master 部署我的应用程序时,它开始构建应用程序并在尝试预编译资产后停止,并出现以下错误:

remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        LoadError: Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile
remote:        /tmp/build_78073b13aac28e116288169779278ade/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'

我已在我的 Gemfile 中验证 gem 实际上位于开发组内,并尝试将 gem 'listen' 移到开发范围之外 as per answers on related questions 但问题仍然存在。

【问题讨论】:

    标签: heroku ruby-on-rails-5


    【解决方案1】:

    要解决此问题,您可以:

    • 注释掉/删除config.file_watcher = ActiveSupport::EventedFileUpdateChecker in config/environments/development.rb 中的行 或
    • 在您的 heroku 配置变量中设置 RAILS_ENV=production。 heroku config:set RAILS_ENV=production
    • config/environments/production.rb 复制到一个新文件config/environments/staging.rb 并在您的heroku 配置变量中设置RAILS_ENV=staging

    我个人更喜欢后者。

    祝你好运?

    【讨论】:

    • 在我的情况下,我们在 production.rb 中有 config.file_watcher 行,注释掉解决了这个问题。我假设我们不需要生产环境中的观察者。
    猜你喜欢
    • 2016-12-04
    • 2021-04-18
    • 2019-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多