Grunt可以加载但不能运行任务

时间:2014-02-26 04:11:59

标签: gruntjs

软件包已正确安装,但无法运行默认任务。我有最新版本的grunt和npm。这是grunt default --verbose

的输出
  Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-contrib-less" local Npm module tasks.
Reading /Users/xxx/Git/x/web/node_modules/grunt-contrib-less/package.json...OK
Parsing /Users/xxx/Git/x/web/node_modules/grunt-contrib-less/package.json...OK
Loading "less.js" tasks...OK
+ less
Loading "Gruntfile.js" tasks...OK
+ default

Running tasks: default

Running "default" task
Warning: Task "grunt-contrib-less" not found. Use --force to continue.

Aborted due to warnings.

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

任务需要与examples show一样less: {...而不是grunt-contrib-less: {...

less: {
  development: {
    options: {
      paths: ["assets/css"]
    },
    files: {
      "path/to/result.css": "path/to/source.less"
    }
  }
}