LoadError: Could not load the 'listen' gem (Rails 5)

前端 未结 10 571
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 05:36

I\'ve got an API mode Rails 5 app that won\'t let me run rake routes or rails s. The error I get is:

$ rake routes
rake aborted!
Lo         


        
10条回答
  •  [愿得一人]
    2020-12-14 06:22

    I had similar problem today after upgrade from Rails 5.1.5 to 5.2.0. First time running the server there was the following 'missing assets' problem:

    ActionView::Template::Error (The asset "asterisk_orange.png" is not present in the asset pipeline.)
    

    Trying to precompile the assets shows the 'gem listen error':

    $ bundle exec rake assets:precompile
    rake aborted!
    LoadError: Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile
    

    My solution was to explicit set production environment:

    $ RAILS_ENV=production bundle exec rake assets:precompile
    

    This precompiles the assets w/o problems and the 'missing assets' problem was fixed.

提交回复
热议问题