gulp-nodemon
gulp-nodemon copied to clipboard
nodemon.tasks does not work on Windows
var Path = require('path');
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
nodemon = require('gulp-nodemon');
gulp.task('jshint', function() {
return gulp.src('*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('watch', function() {
nodemon({
script: Path.resolve('index.js'),
ext: 'js html',
tasks: ['jshint'] // doesn't work on Windows
});
});
The above code is a simple task for monitoring a hapijs server. The nodemon reloads the server but the tasks: ['jshint']
does not execute.
I did a small bit of debugging and it looks like this line in the code does not seem to do anything:
cp.spawnSync('gulp', tasks, { stdio: [0, 1, 2] })
Link to source: https://github.com/JacksonGariety/gulp-nodemon/blob/master/index.js#L74
I get no error or feedback.
I changed this line to gulp.run(tasks)
(just to test it) and that worked, but you get a warning that gulp.run()
is obsolete and should not be used.
Running on nodejs 0.12.7
If you're curious about the code, it's here:
https://github.com/Yuioup/hapi-test
It's not very exciting.
It works on Linux BTW
Confirmed: I'm having the same issue on Windows 7, with Node.js v0.12.7
.
Thanks for the temporary workaround, @Yuioup.
I'm getting this problem too. Cheers for the work-around!
@Yuioup I don't have a windows system. Would you try removing the stdio: []
part and see if you get some feedback on the console when that line is reached?
I had this problem on Ubuntu 15.10. I had the same problem where
cp.spawnSync(process.platform === 'win32' ? 'gulp.cmd' : 'gulp', tasks, { stdio: [0, 1, 2] })
had no effect. This is because it assumes that gulp is installed globally.
Installing gulp globally seemed to do the trick. I guess the correct behaviour here would be to check for a local one, then fallback to global if local doesn't exist.
Also problem on Xubuntu 14.04 LTS, [email protected] installed globally with gulp aswell and Node v4.3.1. tasks option is "ignored".
It worked on latest OS X [email protected] and Node v4.1.2
As robbie-c wrote three months ago, still doesn't work on Ubuntu when gulp not installed globally.
I'm having this problem on a MAC in both installed cases, locally or globally.
Same problem inside a Docker container (node:4 and node:6) on Ubuntu 14.04 LTS. Installing gulp globally in the container solved it