ChrisWren / grunt-nodemon

Grunt task to run nodemon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to run in dev

AndrewKeig opened this issue · comments

Hi; wanted to run this in a dev env; but had to make a few assumptions as to how it works from your example (you only mention prod and you do not register the task): is the below correct..

When i run the below from a terminal it simply returns..

grunt nodemon

module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-nodemon');

grunt.initConfig({
nodemon: {
dev: {
options: {
file: 'app.js',
args: ['development'],
ignoredFiles: ['README.md', 'node_modules/**'],
watchedExtensions: ['js', 'coffee'],
watchedFolders: ['test', 'tasks'],
debug: false,
delayTime: 1
}
}
}
});

grunt.registerTask('nodemon', ['nodemon']);
};

I am making the assumption that the user has done grunt configuration before, that is why I link to the Getting Started guide in the README for those who are new to grunt.

Your issue is following statement:

grunt.registerTask('nodemon', ['nodemon']);

The registerTask method is used to define a task, so when you register a task with the name nodemon it overwrites the grunt-nodemon plugin's task. You can verify this by placing

grunt.loadNpmTasks('grunt-nodemon');

below the registerTask line and then grunt nodemon will work.

To fix your problem simply remove the registerTask line from your Gruntfile.js.

If you are curious about registering tasks, check out this page.

Happy grunting!

.thanks