The grunt-contrib-requirejs task stops Grunt without error


I have a problem where my grunt-contrib-requirejs task stops my grunt processes. It does this with no errors at all. I need help identifying the issue.

My overall task

grunt.registerTask('build', [

This is my task configuration

requirejs: {
    dist: {
        options: {
            baseUrl: 'app',
            optimize: 'none',
            optimizeCss: 'none', // We use cssmin for this
            preserveLicenseComments: true,
            dir: 'dist/',

            useStrict: true,
            wrap: false,
            findNestedDependencies: true,

            //If set to true, any files that were combined into a build bundle will be
            //removed from the output folder.
            removeCombined: true,

            paths: {
                aura: '<%= settings.bower %>/aura/lib/aura',
                underscore: '<%= settings.bower %>/underscore/underscore',
                eventemitter: '<%= settings.bower %>/eventemitter2/lib/eventemitter2',
                backbone: '<%= settings.bower %>/backbone/backbone',
                handlebars: '<%= settings.bower %>/handlebars/handlebars',
                text: '<%= settings.bower %>/requirejs-text/text',
                jquery: '<%= settings.bower %>/jquery/jquery'

            shim: {
                backbone: {
                    exports: 'Backbone',
                    deps: ['underscore', 'jquery']
                underscore: {
                    exports: '_'
                handlebars: {
                    exports: 'Handlebars'

            modules: [{
                name: "app",
                include: ["aura","jquery"]

            onBuildWrite: function( name, path, contents ) {
                grunt.log.writeln( 'Writing: ' + name );
                return contents

            done: function(done, output) {
                var duplicates = require('rjs-build-analysis').duplicates(output);

                if (duplicates.length > 0) {
                    grunt.log.subhead('Duplicates found in requirejs build:');
                    done(new Error('r.js built duplicate modules, please check the excludes option.'));

                grunt.log.writeln('All done');



I tried running it with the -v flag, but I get no errors or warnings. It then just stops, and does not run the other tasks that I defined, I don't get the custom loggings that I defined. I get this output:

Running "requirejs" task

Running "requirejs:dist" (requirejs) task
Verifying property requirejs.dist exists in config...OK
File: [no files]
Options: logLevel=0, done=undefined, baseUrl="app", optimize="none", optimizeCss="none", preserveLicenseComments, dir="dist/", useStrict, wrap=false, findNestedDependencies, removeCombined, paths={"aura":"bower_components/aura/lib/aura","underscore":
ext","jquery":"bower_components/jquery/jquery"}, shim={"backbone":{"exports":"Backbone","deps":["underscore","jquery"]},"underscore":{"exports":"_"},"handlebars":{"exports":"Handlebars"}}, modules=[{"name":"app","include":["aura","jquery"]}], onBuild
>> Tracing dependencies for: app

It seems from this output that the done function is not defined, but I did define it, I even used a example from the grunt-contrib-requirejs readme.

I'm using [email protected] and [email protected] with [email protected]. Node is version v0.8.16

Update one

I tried upgrading my Node, I'm now on v0.10.17 but no changes here.

I removed aura from my modules include, it now looks like this:

modules: [{
    name: "app",
    include: ["jquery"]

This gave me a little more input, but it still stops my Grunt, and does not run my done function, I get this output:

>> app.js
>> ----------------
>> bower_components/aura/lib/platform.js
>> bower_components/aura/lib/base.js
>> bower_components/aura/lib/logger.js
>> bower_components/aura/lib/aura.extensions.js
>> bower_components/aura/lib/aura.js
>> app.js

The issue is that your done function is failing and the grunt task wasn't set up to forward the error to you. I made a PR that you can look at here to resolve the issue.