0

I have read a lot of different posts before asking here but I can't get through that error "Uglify not found"..

I have downloaded node.js, uglfy.js.. Shortly I have followed all the steps here.. How to install grunt and how to build script with it

my Gruntjs file:

module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            build: {
                src: 'js/global.js',
                dest: 'js/build/global.min.js'
            }
        }
    });

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

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

and package.json:

{
    "name": "contentImageSlider",
    "version": "0.1.0",
    "devDependencies": {
        "grunt": "^0.4.5",
        "grunt-contrib-concat": "^0.4.0",
        "grunt-contrib-jshint": "~0.10.0",
        "grunt-contrib-nodeunit": "~0.3.3",
        "grunt-contrib-uglify": "~0.4.0"
    },
    "description": "slider",
    "main": "Gruntfile.js",
    "dependencies": {
        "grunt": "^0.4.5"
    },
    "scripts": {
        "test": "test"
    },
    "repository": {
        "type": "git",
        "url": "https://github.com/haldunatar/contentImageSlider.git"
    },
    "author": "",
    "license": "ISC",
    "bugs": {
        "url": "https://github.com/haldunatar/contentImageSlider/issues"
    },
    "homepage": "https://github.com/haldunatar/contentImageSlider"
}

Error :

Local Npm module "grunt-contrib-uglify" not found. is it installed?
Warning:Tast 'uglify' not found. use --force to continue.

Aborted due to warnings.

So every time as I enter "grunt", it gives that error..but I downloaded uglify.js..

Can anybody help me here?

Thanks in advance!

Community
  • 1
  • 1
  • 1
    Can you please provide your `Gruntfile.js` and `package.json` files? And can you provide the full output for the command that fails? – dylants May 28 '14 at 19:04

1 Answers1

1

I see that the "grunt-contrib-uglify" is in your package.json file, but the error indicates it's not installed. Perhaps you recently added the dependency but did not perform an npm install? Try running npm install from the root directory, then re-running grunt.

dylants
  • 22,316
  • 3
  • 26
  • 22
  • holy, moly!!:) Thanx alot! – user3464303 May 28 '14 at 20:10
  • Sure no problem, glad it worked! You may have downloaded the uglify code, but maybe it wasn't added in the correct location (within the `node_modules` directory). By using `npm install` you'll be sure the dependencies are installed in the correct location. – dylants May 28 '14 at 20:12