15

我的 grunt 没有给出任何输出,我只是安装了所有的系统、NPM 和 grunt-cli。当我输入“grunt -v”时,什么也没有返回。这是我的 package.json:

{
  "name": "project",
  "version": "2.0.0",
  "devDependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-coffee": "~0.7.0",
    "grunt-contrib-compass": "~0.6.0",
    "grunt-contrib-uglify": "~0.2.2",
    "grunt-contrib-watch": "~0.5.3",
    "grunt-yui-compressor": "~0.3.0",
    "grunt-contrib-cssmin": "~0.7.0"
  }
}

我的 Gruntfile.coffee 是:

module.exports = (grunt) ->

  # Project configuration.
  grunt.initConfig
    pkg: grunt.file.readJSON("package.json")

    coffee:
      glob_to_multiple:
        expand: true
        flatten: true
        src: ['assets/javascripts/source/*.coffee']
        dest: 'assets/javascripts/build/'
        ext: '.js'

    compass:
      dev:
        options:
          config: 'config.rb'

    cssmin:
      add_banner:
        options:
          banner: '/* Compilado em ' + grunt.template.today('dd/mm/yyyy') + ' */'
        files:
          'assets/styles/build/site.min.css': ['assets/styles/build/site.css']
          'assets/styles/build/site-ie7.min.css': ['assets/styles/build/site-ie7.css']

    uglify:
      dev:
        files:
          'assets/javascripts/build/scripts.min.js':[
            'assets/javascripts/build/scripts.js'
            'assets/javascripts/build/zt-validator.js'
            'assets/javascripts/build/jquery-zt.js'
          ]
      dist:
        files:
          'assets/javascripts/build/scripts-full.min.js':[
            'assets/javascripts/build/scripts.js'
            'assets/javascripts/build/zt-validator.js'
            'assets/javascripts/build/jquery-zt.js'
            'assets/javascripts/build/site.js'
          ]

    watch:
      options: { spawn: false }
      coffee:
        files: ["assets/javascripts/source/*.coffee"]
        tasks: ["coffee","uglify"]
      compass:
        files: ["assets/styles/**/*.sass","assets/styles/**/*.scss"]
        tasks: ["compass","cssmin"]


  grunt.loadNpmTasks "grunt-contrib-coffee"
  grunt.loadNpmTasks "grunt-contrib-watch"
  grunt.loadNpmTasks "grunt-contrib-compass"
  grunt.loadNpmTasks "grunt-contrib-cssmin"
  grunt.loadNpmTasks "grunt-contrib-uglify"

  # Default task(s).
  grunt.registerTask "default", ["coffee", "compass"]

我不知道如何调试它。

4

3 回答 3

37

尝试删除包“节点”。它与 NodeJS 无关,删除它为我解决了这个问题。

您可以通过运行sudo apt-get remove node并重新安装 nodejs-legacy来完成此操作sudo apt-get install nodejs-legacy

于 2013-12-23T14:18:12.107 回答
8

我必须在 Ubuntu 13.10 上安装“node-legacy”才能让“grunt”正常工作。仅仅安装“节点”是不够的。

于 2014-02-24T09:58:32.033 回答
1

如果您使用的不是最新版本grunt-cli,请升级它。

您可能会被此更新修复的问题所困扰,这可能解释了您和我在使用交换机时得到的不同结果。

于 2013-11-14T20:44:25.587 回答