Installing Grunt on Ubuntu 14.04

I tried to install grunt on Ubuntu 14.04 and wrote grunt serve

I am getting this error.

Warning: Task "serve" not found. Use --force to continue.

Aborted due to warnings.

  1. I have Gruntfile.js in my project folder next to package.json file
  2. When I write grunt –version I get:

         grunt-cli v0.1.13
         grunt v0.4.5
    
  3. I tried @Tom P’s answer:

  4. I have read Grunt documentation

  5. All Installations done through sudo

  6. Tried this as well

This is the Gruntfile sample code I took from Official Grunt documentation.

 module.exports = function(grunt) {
      // Project configuration.
      grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
      uglify: {
                 options: {
                 banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */n'
      },
      build: {
                 src: 'src/<%= pkg.name %>.js',
                 dest: 'build/<%= pkg.name %>.min.js'
      }
    }
});

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

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

 };


Source: ubuntu

Leave a Reply