Reputation: 117
there is a problem in my code.
I wrote in concole: grunt connect
This is the errormessage:
Loading "gruntfile.js" tasks...ERROR
ReferenceError: grunt is not defined Warning: Task "connect" not found. Use --force to continue.
Aborted due to warnings.
And this is my gruntfile.js file:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
uses_defaults: {}
}
});
// Load Grunt plugins
grunt.loadNpmTasks('');
// Default task(s).
grunt.registerTask('default', []);
};
// Load Grunt plugins
grunt.loadNpmTasks('grunt-contrib-connect');
What is the problem in my code? Why doesn't it find the connect task?
Upvotes: 1
Views: 2515
Reputation: 2248
"Every Gruntfile (and gruntplugin) uses this basic format, and all of your Grunt code must be specified inside this function:" -https://gruntjs.com/getting-started
module.exports = function(grunt) {
// Do grunt-related things in here
};
Moving grunt.loadNpmTasks('grunt-contrib-connect');
inside this function should fix it.
Upvotes: 0