Skip to content

Rebuild does not happen ever #205

Closed
Closed

Description

@franleplant

Hi!
I've used watchify several times without problems, but right now it's not working for me.
This is the command I'm running:

watchify -v -t babelify js/index.js -o js/bundle.js

This are my specs:

  • OS X Yosemite 64 bit
  • Zsh
  • Watchify 3.1.0

Any ideas how to solve this?

Thanks!
Fran

Activity

  1. mattdesl commented on Apr 16, 2015

    @mattdesl
    Contributor

    Working for me. My specs:

    • OSX yosemite (10.10.1) with regular terminal
    • watchify 3.1.1
    • babelify 6.0.2
    • npm 2.8.2
    • node 0.10.32

    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:

    npm install watchify babelify --save-dev
    

    And add a scripts to your package.json; this will run the local version:

    "scripts": {
        "watch": "watchify -v -t babelify js/index.js -o js/bundle.js"
    }

    Now npm run watch and see what happens. This will help rule out a few things. 😄

  2. changed the title [-]Rebuild does not happens ever[/-] [+]Rebuild does not happen ever[/+] on Apr 16, 2015
  3. franleplant commented on Apr 16, 2015

    @franleplant
    ContributorAuthor

    @mattdesl your suggestion did not work. I was already working with and without npm.
    I've done some additional steps nevertheless.

    • Update npm, now my version is 2.7.2
    • Checked my node version: 0.12.2
    • Babelify version 6.0.2

    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

  4. franleplant commented on Apr 16, 2015

    @franleplant
    ContributorAuthor

    Just for the sake of removing obvious things I've tried:

    • Running the npm task as sudo
    • Changing the source files permissions: sudo chmod -R 777 .

    I didnt work

  5. rashkov commented on Apr 16, 2015

    @rashkov

    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.

  6. zertosh commented on Apr 16, 2015

    @zertosh
    Member

    @rashkov I saw your vim issue, I'll look into it. @franleplant Are you also using vim? If not, what editor?

  7. franleplant commented on Apr 16, 2015

    @franleplant
    ContributorAuthor

    Im also using vim!
    I tried with Sublime Text 3 with no differences.

  8. rashkov commented on Apr 17, 2015

    @rashkov

    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.

  9. franleplant commented on Apr 17, 2015

    @franleplant
    ContributorAuthor

    @rashkov what OS are you using?

    (It seems that we are experiencing different issues yes)

  10. rashkov commented on Apr 17, 2015

    @rashkov

    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');
    });
    
  11. TylerK commented on Apr 17, 2015

    @TylerK

    I'm also having the same issue as @franleplant

    • OSX 10.10.3
    • Node 0.12.2
    • NPM 2.7.5
    • Watchify 3.1.1
    • SublimeText 3

    When files are saved they're successfully kicking off my linters and other watch processes, but not Watchify.

  12. franleplant commented on Apr 18, 2015

    @franleplant
    ContributorAuthor

    @rashkov run the test that you suggested and editing a.js file with vim triggers the change event.

  13. zertosh commented on Apr 19, 2015

    @zertosh
    Member

    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.

  14. DavidStrada commented on Apr 19, 2015

    @DavidStrada

    I don't know if I was having the same problem but i solve mine by replacing -o and use instead --outfile
    ( pasted my config below ).

    watchify app/app.js -t babelify --outfile bundle.js --debug --verbose
  15. 8 remaining items

  16. zertosh commented on Apr 25, 2015

    @zertosh
    Member

    @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).

  17. franleplant commented on Apr 27, 2015

    @franleplant
    ContributorAuthor

    Yes, I agree this all seems strange, let me know if you find out anything.

    Thanks a lot for your support.

  18. rashkov commented on Apr 27, 2015

    @rashkov

    @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.

  19. Dudemullet commented on Apr 27, 2015

    @Dudemullet

    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.

  20. zertosh commented on Apr 27, 2015

    @zertosh
    Member

    @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.

  21. jatcwang commented on Apr 28, 2015

    @jatcwang

    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 s where watch is my setup for watchify.

    Here are my relevant configurations in gulpfile.js

    gulp.task('watch', function() {
      var opts = _.assign({}, watchify.args, {poll: true});
      var bundler = watchify(browserify('./js/main.js', opts));
      bundler.transform(babelify);
      bundler.on('update', rebundle);
    
      function rebundle() {
        return bundler.bundle()
          // log errors if they happen
          .on('error', gutil.log.bind(gutil, 'Browserify Error'))
          .pipe(source('bundle.js'))
          .pipe(gulp.dest('./dist'))
          .pipe(reload({stream: true}));
      }
    
      return rebundle();
    });
    

    For polling, I tried poll: true as well as poll: 300 but 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.

  22. franleplant commented on Apr 28, 2015

    @franleplant
    ContributorAuthor

    @jtcwang you should try to run watchify via the CLI.

  23. zertosh commented on Apr 29, 2015

    @zertosh
    Member

    @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.

  24. benmosher commented on May 4, 2015

    @benmosher

    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)

  25. franleplant commented on May 4, 2015

    @franleplant
    ContributorAuthor

    @benmosher I've done the touch ing and checking on Finder and the changes are reflected immediately.

    Nevertheless I did mv '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?

  26. zertosh commented on May 5, 2015

    @zertosh
    Member

    @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?

    @franleplant PR welcomed :)

  27. Dudemullet commented on May 5, 2015

    @Dudemullet

    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

  28. franleplant commented on May 7, 2015

    @franleplant
    ContributorAuthor

    @zertosh done! Not sure about the doc styling so let me know if you want to present this info in some other way.

  29. locked and limited conversation to collaborators on May 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy