Grunt doesn't give any output [Ubuntu]

坚强是说给别人听的谎言 提交于 2019-12-30 03:56:06

问题


My grunt doesn't give any output, and I just installed all the system, NPM and grunt-cli. When I type "grunt -v" nothing is returned. This is my 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"
  }
}

And my Gruntfile.coffee is:

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"]

I don't know how to debug it.


回答1:


Try removing the package "node". It's not related to NodeJS and removing it resolved the problem for me.

You can accomplish this by running sudo apt-get remove node and reinstall nodejs-legacy with sudo apt-get install nodejs-legacy




回答2:


I had to install 'node-legacy' on Ubuntu 13.10 in order to get 'grunt' working. Just installing 'node' was not enough.




回答3:


If you aren't on the latest version of grunt-cli, upgrade it.

You might be getting caught by the problem this update fixed and that likely explains the different results you and I are getting with the switches.



来源:https://stackoverflow.com/questions/19953216/grunt-doesnt-give-any-output-ubuntu

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!