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

You might by mistake have set bundle install --without at some point, I sure did anyways.

To revert this run:

bundle config --delete without

I also ran bundle config --delete with as I manually set with option as well by mistake. Running both should get you back to default behaviour.

After having deleted the without config I could successfully run a bundle install again and afterwards my rails s, rails db:migrate etc. worked.


You can confirm if this is your issue by running bundle install and look at the second last line in the output. If it states:

Gems in the groups development and test were not installed.

It's for sure above solution should work for you.


If you are on rails 5 and you are using the default config/environments/development.rb file it will have this line of code in there.

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

This requires the gem listen. This threw me for a bit as I was doing a rails 4 upgrades to a rails 5

edit: Forgot to mention that if you comment that line of code out it will not need the listen gem anymore.


I used this: bundle install --without development

Error:

Could not load the 'listen' gem. Add gem 'listen' to the development group of your Gemfile (LoadError)

After this, use that code:

bundle config --delete without
bundle config --delete with

Finally

bundle install