Closed Devric closed 10 years ago
Can you show me the exact Gruntfile.js and terminal output after running grunt nodemon?
app.js is the express server file, port 3000
minimal gruntfile just to test
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
concurrent : {
run : ['nodemon', 'watch']
}
, nodemon : {
script : 'app.js'
}
, watch: {
options : {
livereload : true
}
, sciprts : {
files : ['routes/**/*.js']
}
, css : {
files : 'public/stylesheets/**/*.css'
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-nodemon');
// Default task.
grunt.registerTask('default', ['concurrent:run']);
};
terminal output
(~ O_o)> grunt nodemon -v
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Initializing config...OK
Registering "grunt-contrib-watch" local Npm module tasks.
Reading /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-contrib-watch/package.json...OK
Parsing /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch
Registering "grunt-concurrent" local Npm module tasks.
Reading /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-concurrent/package.json...OK
Parsing /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-concurrent/package.json...OK
Loading "concurrent.js" tasks...OK
+ concurrent
Registering "grunt-nodemon" local Npm module tasks.
Reading /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-nodemon/package.json...OK
Parsing /Users/Devric/Sites/test/grunthub/a/node_modules/grunt-nodemon/package.json...OK
Loading "nodemon.js" tasks...OK
+ nodemon
Loading "Gruntfile.js" tasks...OK
+ default
Running tasks: nodemon
Running "nodemon" task
Running "nodemon:script" (nodemon) task
Verifying property nodemon.script exists in config...OK
Files: app.js -> script
Options: (none)
ah, so you need to change your nodemon config to have a target (such as dev) like so:
nodemon: {
dev: {
script: 'app.js'
}
}
it is currently treating script
as a files object as seen with this output:
Files: app.js -> script
You should then be able to run grunt nodemon:dev
. Let me know if this works.
hm, its working! :+1:
I'm testing this task with grunt nodemon -v
the output for nodemon
but the server doesn't come up, it just go back to bash, it works normally if i just run nodemon not from grunt.
i've tried different Gruntfile configs, starting from the minimal config from sample