提示错误:
D:\grunt-in-action\grunt-empty>grunt copy
Loading "Gruntfile.js" tasks...ERROR
>> ReferenceError: grunt is not defined
Warning: Task "copy" not found. Use --force to continue.
我的Gruntfile.js内容如下:
'use strict'
//grunt的基本框架
module.exports=function(grunt){
//引组件
reqire("load-grunt-tasks")(grunt);
reqire("time-grunt")(grunt);
//配置项目路径
var config={
app:'app',
dist:'dist'
};
};
//开始任务配置
grunt.initConfig({
//引入config设置
config:config,
copy:{
dist:{
src:'<%= config.app %>/index.html',//源文件
dest:'<%= config.dist %>/index.html'//目标文件
}
}
});
我的package.json:
{
"name": "grunt-empty",
"version": "1.0.0",
"description": "learn grunt by the empty project",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"grunt",
"empty",
"merge"
],
"author": "zrx",
"license": "ISC",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-copy": "^0.8.0",
"load-grunt-tasks": "^3.1.0",
"time-grunt": "^1.1.0"
}
}
snow2012