LoadError: Unable to load 'listening' gem (track 5)
P粉087074897
P粉087074897 2023-10-20 12:50:56
0
2
535

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粉087074897
P粉087074897

reply all(2)
P粉463824410

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.

P粉704196697

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template