0
votes

I have just started with Grunt and I keep getting this error. Reference error: model is not not defined.

Possibly something wrong with my config? I followed these steps.

  1. Installed grunt-cli globally with npm install -g grunt-cli
  2. Installed grunt to local directory with npm install grunt
  3. Created this Gruntfile.js in local directory.
  4. Run -> grunt default -v

My Gruntfile.js

    model.exports = function (grunt) {

    grunt.registerTask("default", function () {
        grunt.log.writelne("Hello world");
      });
    };
1

1 Answers

0
votes

The error is indicating the model variable is undefined in your Gruntfile.js. The proper variable in this instance is module. There's also a typo in grunt.log.writelne.

So, the correct format would be

module.exports = function (grunt) {

    grunt.registerTask("default", function () {
        grunt.log.writeln("Hello world");
    });
};

You can view the Sample Gruntfile.js in the Grunt.js reference docs for the general format.