You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having issues with Vim as well. It actually does run the first few times that I save, and then it stops watching whatever file I'm working with. I think this has to do with how Vim saves. I think it does a "safe write" which fully replaces the file at once.
I'm using Linux. You mentioned earlier that maybe it's an fsevents issue. From what I understand, watchify uses chokidar to watch for file changes, and chokidar uses fsevents to make that work on OS X systems. You might want to try to npm install chokidar and then run something like this, and then try saving your file to see if it picks up on that change. Make sure to change "./a.js" to the file that you're editing, of course.
var chokidar = require('chokidar');
chokidar.watch('./a.js').on('change', function(){
console.log('changed');
});
I spent the day fixing other thing so I haven't had a chance to test out what I'm about to suggest:
w.r.t. the editor and the change event: If your editor isn't doing an "edit" but rather an "alternate-save-then-rename" (vim's swap file, or sublime's "atomic_save"), then I'm not entirely sure that chokidar fires a "change" event. maybe that's considered an "unlink" followed by an "add"?
w.r.t. fsevents, have you tried watchify's "poll" option? that switches chokidar into polling mode, which IIUC does not use fsevents.
w.r.t. other watchers working, #201 (comment) might offer some clues.
@franleplant Yup pretty much every test relies on the watcher correctly firing an update event. I think nodemon usesfs.watch, but it seems to try a lot of different approaches.
The nodemon bit is strange. I'm on OS X 10.10.3 (bash 4.3.33(1)-release - not that I think it matters) and I normally edit with Sublime Text 3 (not that I think it matters either). My most watcher heavy projects run from gulp, and they involve watchify, multiple gulp.watch (for css and templates), and nodemon (for a server).
@zertosh --poll helps, although it will still occasionally miss a 'change' event and not trigger the rebuild. However it doesn't just stop watching the file like it would without --poll.
FWIW, I ran a test using watchify on a simple project. (2 files, 1 requires the other, no polling) and everything seems to be working fine. But when I use it on a complex project (20+ source files, nested directories 3+ levels) thats when I stopped working without the poll.
I'll try and come up with a more specific example so we can narrow it down.
@Dudemullet Yes please, if you can come up with something I can test locally, that'd be awesome. wrt a complex project, I've got wayyyy bigger builds than that - with devs on different machines and envs. BUT, we do have shallow dir structures - 3 levels max. I have to run an experiment with something deeper.
@jtcwang I don't think your issue is what's being talked about in this thread. Your issue doesn't seem to be related to watchify since your problem is with the length of the initial build. Please open a new issue with a bit more detail.
FWIW: I've seen this issue with chokidar on OS X due to the fsevents getting hosed for a given folder. Many people on my team routinely have to either move their working directory to a folder that hasn't been trashed, or use one of the techniques here to "repair" the broken folder.
An easy test to see if fsevents is a likely culprit: open Finder in your working directory (where your JS is), and then touch a new file in that folder from a terminal. If you don't see the touch'd file in Finder immediately, fsevents may be hosed for that folder, or one of its ancestors.
(a few of my teammates had it broken for the entire /Users folder, and had to move the working directory to a /Dev folder to get events working again)
@benmosher I've done the touch ing and checking on Finder and the changes are reflected immediately.
Nevertheless I didmv 'd my project folder to a different name and then mv 'd back to its original name and watchify started working without the --poll flag.
This is a really annoying bug in OS X's file system!
@zertosh so this is a far as we can get towards resolving my original problem, maybe creating some notes in the watchify docs about this?
I know this is farfetched but, have you all updated to the latest version? Has not happened to me since. Thats why I haven't been able to reproduce a proper to test
Activity
mattdesl commentedon Apr 16, 2015
Working for me. My specs:
It could be you are running an old version of watchify (e.g. global install), or maybe something to do with the babel transform.
I would do this:
And add a scripts to your package.json; this will run the local version:
Now
npm run watchand see what happens. This will help rule out a few things. 😄[-]Rebuild does not happens ever[/-][+]Rebuild does not happen ever[/+]franleplant commentedon Apr 16, 2015
@mattdesl your suggestion did not work. I was already working with and without npm.
I've done some additional steps nevertheless.
Another clue is that Im using Vim to edit files, I suppose that is not relevant at all but I state it nevertheless.
Perhaps the problem is fsevents.
Also, I might need to restart my computer, but it's impossible right now 😄
Thanks a lot for your help.
Fran
franleplant commentedon Apr 16, 2015
Just for the sake of removing obvious things I've tried:
npmtask assudosudo chmod -R 777 .I didnt work
rashkov commentedon Apr 16, 2015
I am having issues with Vim as well. It actually does run the first few times that I save, and then it stops watching whatever file I'm working with. I think this has to do with how Vim saves. I think it does a "safe write" which fully replaces the file at once.
zertosh commentedon Apr 16, 2015
@rashkov I saw your vim issue, I'll look into it. @franleplant Are you also using vim? If not, what editor?
franleplant commentedon Apr 16, 2015
Im also using vim!
I tried with Sublime Text 3 with no differences.
rashkov commentedon Apr 17, 2015
Sublime text doesn't have this problem for me, and emacs either. Only Vim gives me trouble. So we are probably looking at two different issues.
franleplant commentedon Apr 17, 2015
@rashkov what OS are you using?
(It seems that we are experiencing different issues yes)
rashkov commentedon Apr 17, 2015
I'm using Linux. You mentioned earlier that maybe it's an fsevents issue. From what I understand, watchify uses chokidar to watch for file changes, and chokidar uses fsevents to make that work on OS X systems. You might want to try to npm install chokidar and then run something like this, and then try saving your file to see if it picks up on that change. Make sure to change "./a.js" to the file that you're editing, of course.
TylerK commentedon Apr 17, 2015
I'm also having the same issue as @franleplant
When files are saved they're successfully kicking off my linters and other watch processes, but not Watchify.
franleplant commentedon Apr 18, 2015
@rashkov run the test that you suggested and editing
a.jsfile with vim triggers the change event.zertosh commentedon Apr 19, 2015
I spent the day fixing other thing so I haven't had a chance to test out what I'm about to suggest:
w.r.t. the editor and the change event: If your editor isn't doing an "edit" but rather an "alternate-save-then-rename" (vim's swap file, or sublime's "atomic_save"), then I'm not entirely sure that chokidar fires a "change" event. maybe that's considered an "unlink" followed by an "add"?
w.r.t. fsevents, have you tried watchify's "poll" option? that switches chokidar into polling mode, which IIUC does not use fsevents.
w.r.t. other watchers working, #201 (comment) might offer some clues.
DavidStrada commentedon Apr 19, 2015
I don't know if I was having the same problem but i solve mine by replacing
-oand use instead--outfile( pasted my config below ).
8 remaining items
zertosh commentedon Apr 25, 2015
@franleplant Yup pretty much every test relies on the watcher correctly firing an update event. I think nodemon uses
fs.watch, but it seems to try a lot of different approaches.The nodemon bit is strange. I'm on OS X 10.10.3 (bash 4.3.33(1)-release - not that I think it matters) and I normally edit with Sublime Text 3 (not that I think it matters either). My most watcher heavy projects run from gulp, and they involve watchify, multiple
gulp.watch(for css and templates), and nodemon (for a server).franleplant commentedon Apr 27, 2015
Yes, I agree this all seems strange, let me know if you find out anything.
Thanks a lot for your support.
rashkov commentedon Apr 27, 2015
@zertosh --poll helps, although it will still occasionally miss a 'change' event and not trigger the rebuild. However it doesn't just stop watching the file like it would without --poll.
Dudemullet commentedon Apr 27, 2015
FWIW, I ran a test using watchify on a simple project. (2 files, 1 requires the other, no polling) and everything seems to be working fine. But when I use it on a complex project (20+ source files, nested directories 3+ levels) thats when I stopped working without the poll.
I'll try and come up with a more specific example so we can narrow it down.
zertosh commentedon Apr 27, 2015
@franleplant Np.
@rashkov Grrr, that's weird.
@Dudemullet Yes please, if you can come up with something I can test locally, that'd be awesome. wrt a complex project, I've got wayyyy bigger builds than that - with devs on different machines and envs. BUT, we do have shallow dir structures - 3 levels max. I have to run an experiment with something deeper.
jatcwang commentedon Apr 28, 2015
I'm running into this issue on Arch.
I'm using Gulp as the task runner, and after about 20 seconds. Gulp say
Finished 'watch' after 16 swherewatchis my setup for watchify.Here are my relevant configurations in
gulpfile.jsFor polling, I tried
poll: trueas well aspoll: 300but neither seem to help.gulp@3.8.11
watchify@3.1.2
browserify@9.0.8
This issue started happening after I upgraded my various dev dependencies.
franleplant commentedon Apr 28, 2015
@jtcwang you should try to run watchify via the CLI.
zertosh commentedon Apr 29, 2015
@jtcwang I don't think your issue is what's being talked about in this thread. Your issue doesn't seem to be related to watchify since your problem is with the length of the initial build. Please open a new issue with a bit more detail.
benmosher commentedon May 4, 2015
FWIW: I've seen this issue with
chokidaron OS X due to the fsevents getting hosed for a given folder. Many people on my team routinely have to either move their working directory to a folder that hasn't been trashed, or use one of the techniques here to "repair" the broken folder.An easy test to see if
fseventsis a likely culprit: open Finder in your working directory (where your JS is), and thentoucha new file in that folder from a terminal. If you don't see thetouch'd file in Finder immediately,fseventsmay be hosed for that folder, or one of its ancestors.(a few of my teammates had it broken for the entire
/Usersfolder, and had to move the working directory to a/Devfolder to get events working again)franleplant commentedon May 4, 2015
@benmosher I've done the
touching and checking on Finder and the changes are reflected immediately.Nevertheless I did
mv'd my project folder to a different name and thenmv'd back to its original name andwatchifystarted working without the--pollflag.This is a really annoying bug in OS X's file system!
@zertosh so this is a far as we can get towards resolving my original problem, maybe creating some notes in the
watchifydocs about this?zertosh commentedon May 5, 2015
@franleplant PR welcomed :)
Dudemullet commentedon May 5, 2015
I know this is farfetched but, have you all updated to the latest version? Has not happened to me since. Thats why I haven't been able to reproduce a proper to test
franleplant commentedon May 7, 2015
@zertosh done! Not sure about the doc styling so let me know if you want to present this info in some other way.