gruntjs / grunt-contrib-compress

Compress files and folders.
http://gruntjs.com/
MIT License
346 stars 114 forks source link

grunt-contrib-compress throws 'No “compress” targets found' and does nothing #179

Closed mbielski closed 8 years ago

mbielski commented 8 years ago

Originally posted on SO (http://stackoverflow.com/questions/36561902/grunt-contrib-compress-throws-no-compress-targets-found-and-does-nothing) but after a week of very low views and no answers I'm posting it here in the hope that maybe it's a bug.

When the compress task is called the output is consistently the following error message:

$ grunt squeeze >> No "compress" targets found. Warning: Task "compress" failed. Use --force to continue.

Aborted due to warnings. Process finished with exit code 3

Config info:

compress:{
    main:{
        options:{
            mode:'gzip',
            level:2
        },
        files:[
            {expand:true, cwd:'E:/s3/', src:['**'], dest:'E:/gz/s3/'}
        ]
    }
}

Grunt task: grunt.registerTask('squeeze', ['compress']);

All folders are known to be present (they are able to be used by a different task just fine.) I've tried the path with both frontslash and backslash, but I get the same result. This is running on W10, Node 4.x, and current version of Grunt and grunt-contrib-compress (1.2.0).

Arkni commented 8 years ago

Did you forget to load the task inside Gruntfile ? I mean adding this line to your Gruntfile as shown in README:

grunt.loadNpmTasks('grunt-contrib-compress');
mbielski commented 8 years ago

No, it's there. I'll admit that I did have to look at the project to make sure, but yes, it's there. That line is after the grunt.initConfig section, but I've never had troubles with that placement for other modules. And just to be thorough, I tried it with that line above the grunt.initConfig section, but still get the same results.

Arkni commented 8 years ago

I can't reproduce your issue on win7 and Linux. Maybe you have done something wrong or something goes wrong during npm install. Can you show us the content of your Gruntfile.js ?

mbielski commented 8 years ago

The system in question is W10, upgraded from W7 Pro, which was upgraded from XP Pro. I'm not sure how I could do something wrong by typing

npm install grunt-contrib-compress

but I've managed to screw up simple things before so it's always best to check things. Therefore, and just to be thorough, I uninstalled and re-installed the module and still get the same results. The uninstall and install both ran fine, no errors or warnings. My Gruntfile.js is as follows:

'use strict';

module.exports = function (grunt) { // Load grunt tasks automatically var log = 'C:/Users/Michael/Desktop/BackupLog.txt'; require('load-grunt-tasks')(grunt); require('logfile-grunt')(grunt, { filePath: log});

// Define the configuration for all the tasks
grunt.initConfig({
    aws: grunt.file.readJSON('grunt-aws.json'),
    aws_s3:{
        options: {
            debug:false,
            region:'us-west-1',
            access:'bucket-owner-full-control',
            overwrite:true,
            displayChangesOnly:true,
            maxRetries:3,
            httpOptions:{
                timeout:12000000
            },
            uploadConcurrency: 5, // 5 simultaneous uploads
            downloadConcurrency: 5, // 5 simultaneous downloads
            differential: true, // Only uploads the files that have changed
            gzipRename: 'swap' // when uploading a gz file, swap the original extension with the .gz extension
        },
        backup:{
            options: {
                accessKeyId: '<%= aws.backup.key %>',
                secretAccessKey: '<%= aws.backup.secret %>',
                bucket: '<%= aws.backup.bucket %>'
            },
            files: [
                {'action':'upload', expand:true, cwd:'E:/s3/', src:['**'], dest:'s3/'},
                {'action':'upload', expand:true, cwd:'E:/quest/', src:['**'], dest:'quest/'},
                {'action':'upload', expand:true, cwd:'E:/Backups/', src:['**'], dest:'Backups/', stream:true},
                {'action':'upload', expand:true, cwd:'E:/Data/2g memory card/', src:['**'], dest:'Data/2g memory card/'},
                {'action':'upload', expand:true, cwd:'E:/Data/2gig drive/', src:['**'], dest:'Data/2gig drive/'},
                {'action':'upload', expand:true, cwd:'E:/Data/ARTracker/', src:['**'], dest:'Data/ARTracker/'},
                {'action':'upload', expand:true, cwd:'E:/Data/2g memory card/', src:['**'], dest:'Data/2g memory card/'},
                {'action':'upload', expand:true, cwd:'E:/Data/books/', src:['**'], dest:'Data/books/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Butch/', src:['**'], dest:'Data/Butch/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Calibre Books/', src:['**'], dest:'Data/Calibre Books/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Camera Videos/', src:['**'], dest:'Data/Camera Videos/'},
                {'action':'upload', expand:true, cwd:'E:/Data/CD/', src:['**'], dest:'Data/CD/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Documents/', src:['**'], dest:'Data/Documents/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Facebook Picts/', src:['**'], dest:'Data/Facebook Picts/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Fonts/', src:['**'], dest:'Data/Fonts/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Food Things/', src:['**'], dest:'Data/Food Things/'},
                {'action':'upload', expand:true, cwd:'E:/Data/From Laptop/', src:['**'], dest:'Data/From Laptop/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Kelley/', src:['**'], dest:'Data/Kelley/'},
                {'action':'upload', expand:true, cwd:'E:/Data/minecon/', src:['**'], dest:'Data/minecon/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Music/', src:['**'], dest:'Data/Music/'},
                {'action':'upload', expand:true, cwd:'E:/Data/My Music/', src:['**'], dest:'Data/My Music/'},
                {'action':'upload', expand:true, cwd:'E:/Data/NoInk/', src:['**'], dest:'Data/NoInk/'},
                {'action':'upload', expand:true, cwd:'E:/Data/old drive/', src:['**'], dest:'Data/old drive/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Paystubs/', src:['**'], dest:'Data/Paystubs/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Pictures/', src:['**'], dest:'Data/Pictures/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Software/', src:['**'], dest:'Data/Software/'},
                {'action':'upload', expand:true, cwd:'E:/Data/Web Projects/', src:['**'], dest:'Data/Web Projects/'},
                {'action':'upload', expand:true, cwd:'E:/Data/work/', src:['**'], dest:'Data/work/'}
            ]
        },
        restore:{
            options: {
                accessKeyId: '<%= aws.restore.key %>',
                secretAccessKey: '<%= aws.restore.secret %>',
                bucket: '<%= aws.restore.bucket %>'
            },
            files:[
                {cwd:'E:/quest/', dest:'quest/', action:'download'}
            ]
        },
        compress:{
            main:{
                options:{
                    mode:'gzip',
                    level:2
                },
                files:[
                    {expand:true, cwd:'E:/s3/', src:['**/*'], dest:'E:/gz/s3/'}
                ]
            }
        }
    },
    open:{
        log:{
            path:log
        }
    }
});

grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-contrib-compress');

grunt.registerTask('default', ['aws_s3:backup','open:log']);
grunt.registerTask('restore', ['aws_s3:restore']);
grunt.registerTask('squeeze', ['compress']);

};

Also, in case it helps, my package.json contains:

{ "name": "backup", "version": "0.0.0", "dependencies": {}, "devDependencies": { "grunt": "~0.4.1", "grunt-aws-s3":"~0.14", "grunt-contrib-compress":"~1.2", "load-grunt-tasks":"~3.4", "logfile-grunt":"~0.2", "grunt-open":"~0.2" }, "engines": { "node": ">=0.8.0" } }

Thanks very much for looking into this.

vladikoff commented 8 years ago

Why is compress under aws_s3? double check that

mbielski commented 8 years ago

BINGO!

(Insert bad words here)

Like I said, I've managed to screw up simple things before. Much thanks vladikoff. Please close this issue.