Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

** ERROR: directory is already being watched! ** #34912

Closed
gr1d99 opened this issue Jan 10, 2019 · 3 comments
Closed

** ERROR: directory is already being watched! ** #34912

gr1d99 opened this issue Jan 10, 2019 · 3 comments

Comments

@gr1d99
Copy link

gr1d99 commented Jan 10, 2019

Someone help me get rid of this errors

Steps to reproduce

  • create a new rails api only application rails new sample_api --api
  • install create-react-app
  • create a new react app in the root directory of the new rails api app create-react-app client
  • start rails app bin/rails s

Expected behavior

| => bin/rails s
=> Booting Puma
=> Rails 5.2.2 application starting in development 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop

Actual behavior

| => bin/rails s
=> Booting Puma
=> Rails 5.2.2 application starting in development 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
        ** ERROR: directory is already being watched! **

        Directory: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/.bin/terser-webpack-plugin

        is already being watched through: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/terser-webpack-plugin

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
        ** ERROR: directory is already being watched! **

        Directory: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/.bin/url-loader

        is already being watched through: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/url-loader

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
        ** ERROR: directory is already being watched! **

        Directory: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/.bin/mini-css-extract-plugin

        is already being watched through: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/mini-css-extract-plugin

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
        ** ERROR: directory is already being watched! **

        Directory: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/.bin/file-loader

        is already being watched through: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/file-loader

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
        ** ERROR: directory is already being watched! **

        Directory: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/react-scripts/node_modules/.bin/terser-webpack-plugin

        is already being watched through: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/terser-webpack-plugin

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
        ** ERROR: directory is already being watched! **

        Directory: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/react-scripts/node_modules/.bin/url-loader

        is already being watched through: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/url-loader

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
        ** ERROR: directory is already being watched! **

        Directory: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/react-scripts/node_modules/.bin/mini-css-extract-plugin

        is already being watched through: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/mini-css-extract-plugin

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors
        ** ERROR: directory is already being watched! **

        Directory: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/react-scripts/node_modules/.bin/file-loader

        is already being watched through: /Users/gr1d99/Projects/ruby/rails/untitled3/client/node_modules/file-loader

        MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors

System configuration

Rails version: 5.2.2

Ruby version: 2.5.1-p57

OS macOS High Sierra version 10.13.2

@tabishiqbal
Copy link

Please see this thread. #32700

@y-yagi
Copy link
Member

y-yagi commented Jan 11, 2019

Thanks for your report. This already fixed by #33822. Please see #32700 (comment) for a temporary solution.

@y-yagi y-yagi closed this as completed Jan 11, 2019
@rolandoalvarado
Copy link

try this, it solves my problem. https://github.com/guard/listen/wiki/Duplicate-directory-errors

y-yagi added a commit to y-yagi/rails that referenced this issue Jun 2, 2019
`spring-watcher-listen` watch application root by default.
https://github.com/jonleighton/spring-watcher-listen/blob/c4bfe15805867e229588e4b776a7b87438137094/lib/spring/watcher/listen.rb#L58

This is necessary to watch the file (e.g. `.ruby-version`) in the
application root.

By this `node_modules` also be watched, and it is a possibility to be
shown a warning by `listen`.
Related to rails#32700, rails#34912, rails/webpacker#1990.

`listen` watches directory recursive by default, and it cannot avoid it.
guard/listen#111

So If this warning happens, the only workaround the user can do is remove
the gem.

The issue is likely to occur more frequently in Rails 6 because
`rails new` runs `webpacker:install` by default. Because of such a
state, I think that we should not recommend to use
`spring-watcher-listen`.

Spring has polling watcher, restart process works without this
`spring-watcher-listen`.
Because of polling base, CPU load may be higher than listen base. Still
I think that it is better than the warning comes out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants