etwobe
etwobe

Reputation: 3

Node.JS / Grunt-Nodemon: ReferenceError: mode is not defined

I'm currently learning Node.JS and want to improve my development speed with Grunt. I've installed the "grunt-cli" globally and also "grunt-nodemon" as a development resource locally through NPM. The goal is that Node.JS restarts, whenever a JavaScript file changed.

Here's what I get in the Console:

D:\Projects\NodeJS\Web\Board\>grunt
Loading "gruntfile.js" tasks...ERROR
>> ReferenceError: mode is not defined
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

Here's my gruntfile.js:

//gruntfile.js
mode.exports = function (grunt) {
    grunt.initConfig({
        nodemon: {
            all: {
                script: 'server.js',
                options: {
                    watchedExtensions: ['js']
                }
            }
        },      
    });
    grunt.loadNpmTasks('grunt-nodemon');
    grunt.registerTask('default', ['nodemon']);
}; 

The console is pointing at the same directory where as the gruntfile.js is.

If you have any idea, let me know. Thanks!

Upvotes: 0

Views: 969

Answers (1)

Line 1 of your code is

mode.exports

it should be

module.exports   // change mode to module. Its a typo in your code

Hence the error

ReferenceError: mode is not defined

check the typo. Happy coding.

Upvotes: 3

Related Questions