找不到任务连接咕噜
Task connect not found grunt
我正在使用 grunt 创建一个本地服务器。但是当我使用 运行 grunt 命令时,它无法找到连接任务。任何人都可以帮助解决这个问题。
注意:我已经搜索过 Whosebug 和 google。
Grunt JS 文件
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"
}
}
您需要单独调用 loadNpmTasks
:
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
您一次只能加载一个插件loadNpmTasks
。
我正在使用 grunt 创建一个本地服务器。但是当我使用 运行 grunt 命令时,它无法找到连接任务。任何人都可以帮助解决这个问题。
注意:我已经搜索过 Whosebug 和 google。
Grunt JS 文件
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"
}
}
您需要单独调用 loadNpmTasks
:
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
您一次只能加载一个插件loadNpmTasks
。