【发布时间】:2014-01-25 04:15:38
【问题描述】:
我无法弄清楚我的配置问题。当我尝试运行“grunt bowercopy”时,我收到以下错误消息:
警告:找不到任务“bowercopy”。使用 --force 继续。
如果我运行“grunt jshint”,jshint 可以正常工作。
这是我的 package.json:
{
"name": "treblebull",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "~3.2.6",
"jade": "~0.31.2",
"underscore": "~1.5.2",
"pg": "~2.11.1"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-bowercopy": "~0.7.1",
"grunt-contrib-jshint": "~0.8.0",
"load-grunt-tasks": "~0.2.1"
}
}
这是我的 gruntfile:
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
lib: {
src: ['lib/**/*.js']
},
test: {
src: ['test/**/*.js']
}
},
bowercopy: {
options: {
clean: true
//srcPrefix: 'bower_components'
},
libs: {
options: {
// destPrefix: 'public/js/lib'
},
files: {
'angular.js': 'angular/angular.js'
//'underscore.js': 'underscore/underscore.js',
//'underscore.string.js': 'underscore.string/underscore.string.js'
}
}
}
});
grunt.loadNpmTasks('grunt-bowercopy');
grunt.loadNpmTasks('grunt-contrib-jshint');
};
【问题讨论】:
-
您的 Gruntfile 中是否有
grunt.loadNpmTasks('grunt-bowercopy');? -
是的,它在 gruntfile 的底部,我猜代码有点太长了,所以你必须在 gruntfile 中滚动才能看到它。