Reputation: 1581
I want to integrate Grunt on my java Script project. I have installed npm, grunt and all.
I have created the package.json file and GRUNTFILE.js for the grunt.
but when i run the "grunt" command i am getting this error 'module' is undefined.
GRUNTFILE.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
});
grunt.registerTask('default', []);
};
Package.json
{
"name": "Example",
"version": "0.0.1",
"private": true,
"devDependencies": {
"grunt": "latest",
"grunt-cli": "^0.1.13"
}
}
Upvotes: 4
Views: 5457
Reputation: 3057
I also had this problem I found that making sure you have correctly named the grunt file to Gruntfile.js
fixed my problem, silly but can be overlooked.
Upvotes: 11
Reputation: 1581
After running following command I am successfully run the grunt on my project.
npm uninstall
npm install -g grunt-cli (which install globally)
npm install (On a Project directory)
Before running the third commend project must contain 'packge.json' and gruntfile.js files.
Upvotes: 2