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

前端 未结 10 596
伪装坚强ぢ
伪装坚强ぢ 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条回答
  •  猫巷女王i
    2020-12-14 06:17

    I had the same issue. Thanks to @newdark answer I figured out the correct solution. Basically I wanted to deploy rails in production mode. But obviously forgot to set environment variable RAILS_ENV=production before running server.

    So to recap, dependencies for production mode were installed while rails tried to start in development mode due to forgetting to set RAILS_ENV=production. If I went on to add gem listen to the production dependencies, I'd be running in development mode without being able to notice.

    For me the solution was to do export RAILS_ENV=production before executing any rails commands and keep dependencies intact. Hope I managed to explain.

提交回复
热议问题