user3045179
user3045179

Reputation: 331

Task connect not found grunt

I am creating a local server using grunt. But when I am running grunt command it is not able to find connect task. Could any one please help on this.

Note: I have searched over stackoverflow and google.

Grunt JS File

module.exports = function(grunt) {
grunt.initConfig({

    pkg: grunt.file.readJSON,

    clean: ["lib/tictactoe/build"],

    connect:{
        all:{
            options:{
                port:9000,
                hostname:'localhost'
            }
        }
    }  


})


grunt.loadNpmTasks('grunt-contrib-clean','grunt-contrib-connect');
grunt.registerTask('default', ['clean','connect']);
}

Package.JSON

{
 "name": "gruntang",
  "private": true,
  "devDependencies": {
"autoprefixer-core": "^5.2.1",
"grunt": "^0.4.5",
"grunt-angular-templates": "^0.5.7",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.0.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.12.0",
"grunt-contrib-htmlmin": "^0.4.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^2.1.2",
"grunt-google-cdn": "^0.4.3",

"jshint-stylish": "^1.0.0"
 },
"engines": {
    "node": ">=0.10.0"
}
}

Upvotes: 1

Views: 461

Answers (1)

cartant
cartant

Reputation: 58400

You need to make separate calls to loadNpmTasks:

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');

You can only load one plugin at a time with loadNpmTasks.

Upvotes: 1

Related Questions