gpt4 book ai didi

node.js - 任务连接未找到 grunt

转载 作者:太空宇宙 更新时间:2023-11-04 00:35:39 25 4
gpt4 key购买 nike

我正在使用 grunt 创建本地服务器。但是当我运行 grunt 命令时,它无法找到连接任务。任何人都可以帮忙解决这个问题吗?

注意:我已经在 stackoverflow 和 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 一次只能加载一个插件。

关于node.js - 任务连接未找到 grunt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39167282/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com