Reputation: 1878
I am starting my node application using grunt command. My Gruntfile.js is:
module.exports = function(grunt) {
grunt.initConfig({
nodemon: {
dev: {
script: 'server.js'
}
},
watch: {
css: {
files: ['src/css/*.scss'],
tasks: ['sass:dev']
},
js: {
files: ['src/js/*.js'],
tasks: ['uglify:dev']
}
},
concurrent: {
options: {
logConcurrentOutput: true
},
tasks: ['nodemon','watch']
}
});
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concurrent');
grunt.registerTask('default',['concurrent']);
};
When I run the application typing grunt
I get the following output:
C:\Projects\SocialMeal>grunt
Running "concurrent:tasks" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
Then every console.log() call at server.js is not shown. If I start the app using node server.js
the console.log() messages are shown.
Any hint?
Upvotes: 1
Views: 2215
Reputation: 1878
Found it thanks to greuze. The problem was nodemon version. Changed it to 1.11.0 and the console.log outputs works now.
Simply removed the current version installed:
npm uninstall grunt-nodemon
And changed package.json:
"grunt-nodemon": "~1.10.0",
Upvotes: 1
Reputation: 4398
I do get console.log
outputs.
I have an server.js
file with content:
let name = 'Peter';
console.log(`My name is: ${name}`);
I used your Gruntfile.js.
I get this output after running grunt
:
Running "concurrent:tasks" (concurrent) task
Running "watch" task
Waiting...
Running "nodemon:dev" (nodemon) task
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
My name is: Peter
[nodemon] clean exit - waiting for changes before restart
Note that there is the console.log output. Are you sure your process is not stuck anywhere?
Upvotes: 0