问题
I am developing a node app that interacts with IRC.
My Gruntfile.js
:
module.exports = function(grunt) {
grunt.initConfig({
watch: {
js: {
files: [
'index.js',
'brains.js',
'lib/*.js'
],
tasks: ['develop'],
options: { nospawn: true }
}
},
develop: {
server: {
file: 'index.js'
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-develop');
grunt.registerTask('default', ['develop']);
};
When I execute grunt it states that it completed and exits. How can I keep grunt watching like in a web based node app?
回答1:
When you're calling grunt
, the default task is running: grunt.registerTask('default', ['develop']);
. Run grunt watch
instead, or change ['develop']
to ['watch']
.
来源:https://stackoverflow.com/questions/21813462/grunt-exiting-when-it-should-be-watching