-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Directory is already being watched #1990
Comments
@cyrusstoller – if you look further down in the error message you should see a link to https://github.com/guard/listen/wiki/Duplicate-directory-errors, which explains why the error occurs. For now, I've gone with adding the following to # Listen >=2.8 patch to silence duplicate directory errors. USE AT YOUR OWN RISK
require 'listen/record/symlink_detector'
module Listen
class Record
class SymlinkDetector
def _fail(_, _)
raise Error, "Don't watch locally-symlinked directory twice"
end
end
end
end … which is a suggestion from the link mentioned above, but not recommended. |
Thanks for sharing. I don't feel great about using that solution. Are there other ways to approach this? |
@cyrusstoller – agreed, this is less than ideal. Unfortunately I didn't come across any other solutions in my (admittedly limited) investigations. The link from the |
Looking at the errors closely, I see: Directory: /Users/jits/Projects/…/node_modules/.bin/compression-webpack-plugin
is already being watched through: /Users/jits/…/patch-list/node_modules/compression-webpack-plugin Directory: /Users/jits/Projects/…/node_modules/.bin/mini-css-extract-plugin
is already being watched through: /Users/jits/…/node_modules/mini-css-extract-plugin … looks like it's mistaking the executables within the @cyrusstoller – are you seeing this too when you get the error? Will try to find time later to investigate further and file a bug report. |
I'm seeing the same thing. Any tips on how I can help investigate? |
Makes sense. I don't think I'm currently watching the node_modules from guard. I'll look for other places. Here's my Guardfile: guard :minitest, spring: "bin/rails test" do
notification :terminal_notifier,
activate: 'com.googlecode.iTerm2' if `uname` =~ /Darwin/
# Rails 4+
watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
watch(%r{^test/.+_test\.rb$})
watch(%r{^test/test_helper\.rb$}) { 'test' }
end |
This would be ideal! I don't think there's a way to do this in Rails apps? |
@jits I changed my stack to let node do all the watching/proxying/reloading with https://github.com/Va1/browser-sync-webpack-plugin It also excludes |
This seems like it might be related: rails/rails#32700 |
There may be a fix for this (if you're using factory_bot): https://github.com/thoughtbot/factory_bot_rails/releases/tag/v5.0.2 |
`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.
Can this issue be closed ? |
I think so. I'm no longer experiencing this issue anymore using the latest versions of Rails. |
Feel free to close it then 👍 |
Thanks @guillaumebriday for reviewing issues 🍰 |
For anyone following this thread, guard and listen warnings are now configurable as of listen v3.9.0. |
This is a fantastic project. I really appreciate being able to develop using Vue and Rails in the same project.
I'm in the process of upgrading to 4.x. I followed the guide and things appear to be functioning properly. However, I'm running into an "error" when using Guard to run my tests and when opening a new rails console.
In my terminal that's running my tests I see the following a few times:
And then I also see it if I open a new rails console.
What's strange to me is that it doesn't really seem to be causing any errors. I'm still able to interact with my project. The node_modules that it calls out are:
This is more of a minor annoyance than anything else. What's odd is if I close the rails console and then open a new rails console the errors don't appear. I'm assuming this has something to do with me using the default spring settings.
I'm not sure what will be most helpful for me to provide to help debug.
Here are some basics:
Any tips for how to resolve these?
The text was updated successfully, but these errors were encountered: