-
Notifications
You must be signed in to change notification settings - Fork 190
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
"jake watch" not working with global modules? #262
Comments
Looks like it's blowing up trying to calculate the exclusions -- indeed node_modules is in the default exclude list: https://github.com/jakejs/jake/blob/master/lib/watch_task.js#L45 This is a pretty bad bug. I'm not sure why it would still not work if you actually have the exclusion directories it wants. I seem to remember there being issues with watch on Windows, but that was some time back. I would have thought it would be working reliably by now. You're absolutely right -- we shouldn't require people to ignore the Jakefile explicitly, even if it has a .js extension (but of course shouldn't require its presence either -- this is a bug). I've opened a ticket for this bug: #263 Thanks for catching this! |
I think you can close this issue : as you said, For the second part (task not working even with a I'm trying to see how Isaacs succeeded to catch file events in its node-supervisor module (which works on Windows !). |
Let me know what you find out. |
Very disappointing... I saw nothing special in the code of node-supervisor, which uses So, I made some tests : I tried to watch a "cli.js" file in a "bin" directory, using the following 'use strict';
var fs=require('fs');
namespace('fsWatch', function() {
desc('File with fs.watch()');
task('file', function() {
fs.watch('bin/cli.js', function() {
jake.logger.log('fs.watch(file) => callback called');
// RESULT: Callback called 2 times on each 'change' event.
});
});
desc('Directory with fs.watch()');
task('dir', function() {
fs.watch('bin', function() {
jake.logger.log('fs.watch(dir) => callback called');
// RESULT: Callback called 2 times on each 'change' event.
});
});
});
namespace('fsWatchFile', function() {
desc('File with fs.watchFile()');
task('file', function() {
fs.watchFile('bin/cli.js', { interval: 1000 }, function() {
jake.logger.log('fs.watchFile(file) => callback called');
// RESULT: Callback called one time on each 'change' event.
});
});
desc('Directory with fs.watchFile()');
task('dir', function() {
fs.watchFile('bin', { interval: 1000 }, function() {
jake.logger.log('fs.watchFile(dir) => callback called');
// RESULT: Callback never called.
});
});
});
desc('Task used as prerequisite for jake.watchTask');
task('log', function() {
jake.logger.log('jake.watchTask => prerequesite called');
});
watchTask([ 'log' ], function() {
this.watchFiles.include([ 'bin/cli.js' ]);
// RESULT: Prerequesite never called.
}); Only the call to |
I gave up: I finally implemented a custom task using nodemon as a required module. I close this issue as 2 things were involved:
|
I'm unable to make
jake watch
task working at all (not even a single time! Do I need to change my brain?).My config: Node.js 0.10.29 and Jake 0.7.17 on Windows 8.1.
I think there are several issues involved, so let's start with the most obvious problem :
jake watch
does not seem to work with global-only modules.Here is my Jakefile:
When I launch
jake watch
and change a file, an error occurs:There is no
node_modules
folder: my project only uses a few global modules (e.g. modules installed withnpm install -g <module>
).Why Jake is looking for
node_modules
folder even if it doesn't exist?If I create this folder, or if I use local modules, this task still doesn't work. But I'm still investigating... Does anyone has succeed in using watch tasks on Windows 8.1?
Off topic: I think watch task should explicitly ignore the
Jakefile
. It's quite common to name itJakefile.js
orJakefile.coffee
, but it's insane to trigger the watch cycle everytime we modify theJakefile
or to ignore it explictly.The text was updated successfully, but these errors were encountered: