I have the next Gruntfile.js
module.exports = function(grunt) {
'use strict';
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Configure Grunt
grunt.initConfig({
// Grunt express - our webserver
// https://github.com/blai/grunt-express
express: {
all: {
options: {
bases: 'xxxxxxxx',
port: 9000,
hostname: '0.0.0.0',
livereload: true
}
}
},
// grunt-watch will monitor the projects files
// https://github.com/gruntjs/grunt-contrib-watch
watch: {
all: {
files: ['**/*.html'],
options: {
livereload: true
}
}
},
// grunt-open will open your browser at the project's URL
// https://www.npmjs.org/package/grunt-open
open: {
all: {
path: 'http://localhost:9000/index.html'
}
},
// grunt-open will install the bower components defined on the bower.json file
// https://www.npmjs.com/package/grunt-bower-install-simple
'bower-install-simple': {
options: {
color: true,
directory: 'assets/bower_components'
},
'prod': {
options: {
production: true
}
},
'dev': {
options: {
production: false
}
}
}
});
// Creates the `server` task
grunt.registerTask('server', [
'express',
'open',
'watch'
]);
};
{
"engines": {
"node": ">= 0.10.0"
},
"devDependencies": {
"grunt-bower-install-simple": "~1.2.0",
"grunt-contrib-watch": "~0.6.1",
"grunt": "~0.4.5",
"matchdep": "~1.0.0",
"grunt-express": "~1.4.1",
"grunt-open": "~0.2.3"
}
}
I try the solution in: Grunt watch error - Waiting...Fatal error: watch ENOSPC
but I still have this error:
Running "watch" task Waiting... Warning: Maximum call stack size exceeded
Did anyone knows what I am doing wrong?
Thanks!
From the doc of grunt-express
, it seems setting livereload
generates a watch task. I believe this task is conflicting with your own watch
task.
Try removing your watch config and amending your server task to keep the server alive:
// Creates the `server` task
grunt.registerTask('server', [
'express',
'open',
'express-keepalive'
]);