Home  >  Q&A  >  body text

LoadError: Unable to load 'listening' gem (track 5)

I have an API mode Rails 5 application that won't let me run rake paths or rails s. The error I get is:

$ rake routes
rake aborted!
LoadError: Could not load the 'lis ten' gem. Add `gem 'lis ten'` to the development group of your Gemfile
.../config/environment.rb:5:in `<top (required)>'
LoadError: cannot load such file -- lis ten
.../config/environment.rb:5:in `<top (required)>'
Tasks: TOP => routes => environment
(See full trace by running task with --trace)

I have verified that li sten is in the development group of my Gemfile:

group :development do
  gem 'lis ten', '~> 3.1.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-li sten', '~> 2.0.0'
end

It's in my Gemfile.lock:

$ cat Gemfile.lock | grep 'li sten'
    li sten (3.1.5)
    spring-watcher-l isten (2.0.0)
      li sten (>= 2.7, < 4.0)
  list en (~> 3.1.5)
  spr ing-watcher-lis ten (~> 2.0.0)

I have updated the bundle, installed the bundle, and verified that gem install Li sten works. This was working earlier this week but I'm having no luck getting it through my commits.

$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]

I don't see it in vendor/cache but I don't know what to do...

$ bundle package | grep 'li sten'

thanks for your help!

renew:

I was able to "fix" the problem by putting the gem 'lis ten', '~> 3.1.5' into the global Gemfile (and remove it from :development to delete). Then all the errors disappear and everything works fine, but this seems wrong.

P粉087074897P粉087074897365 days ago495

reply all(2)I'll reply

  • P粉463824410

    P粉4638244102023-10-21 12:03:29

    If you are using Rails 5 and using the default config/environments/development.rb file, it will contain this line of code.

    config.file_watcher = ActiveSupport::EventedFileUpdateChecker

    This requires gem listening. This confused me a bit when I upgraded from Rails 4 to Rails 5

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

    reply
    0
  • P粉704196697

    P粉7041966972023-10-21 09:48:59

    I posted this as an answer but I don't like it.

    I was able to "fix" this by putting the gem 'listen', '~> 3.1.5' into the global Gemfile (and removing it from :development) The problem. Then all the errors disappear and everything works fine, but this seems wrong.

    reply
    0
  • Cancelreply