Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'grunt' command doesn't do anything

I'm following the grunt getting started guide for my new app, but I'm having some trouble.

This is my Gruntfile.js

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {,
      build: {
        src: 'js/*.js',
        dest: 'build/*.min.js'
      }
    }
  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');

  // Default task(s).
  grunt.registerTask('default', ['uglify']);

};

This is my package.json

{
  "name": "My App",
  "version": "0.0.0",
  "description": "",
  "author": "",
  "license": "N/A",
  "devDependencies": {
    "grunt": "~0.4.2",
    "grunt-contrib-jshint": "~0.8.0",
    "grunt-contrib-uglify": "~0.2.7"
  }
}

I have the grunt-cli package installed and I've run npm install to get a local version of grunt and the contrib libraries.

But when I run either grunt or grunt uglify nothing happens.

$ grunt
$ grunt uglify
$

Any idea what I have missed or what could cause this behaviour?

EDIT: I just installed mocha too and I get the same issue with that: no output. Maybe there is a problem with my node or npm installation

like image 484
Jim Jeffries Avatar asked Jan 05 '14 18:01

Jim Jeffries


2 Answers

So it looks like this was an environment setup issue. I had an ubuntu package called node installed as well as nodejs which was preventing the packages installed through npm from working. Running the following command fixed the issue.

sudo apt-get --purge remove node
like image 188
Jim Jeffries Avatar answered Oct 20 '22 00:10

Jim Jeffries


I had the same problem. Grunt was not responding. No output was being displayed. Removing node and installing nodejs-legacy worked for me.

Removing node by:

sudo apt-get --purge remove node

and installing legacy by:

sudo apt-get install nodejs-legacy
like image 21
Srishti Gupta Avatar answered Oct 20 '22 00:10

Srishti Gupta