Fixed problems with grunt-newer and grunt-contrib-watch.
"grunt watch" gets an error: "Warning: Unable to write "undefined" file (Error code: undefined). Use --force to continue."
Therefore "this.data.dest" is undefined in an "grunt watch", use this.files instead.

"grunt build" is successful without errors.

Example configuration for this problem

package.json

{
    "name": "application-name",
    "version": "0.0.1",
    "dependencies": {
        "grunt": "~0.4.4",
        "grunt-contrib-clean": "~0.5.0",
        "grunt-contrib-copy": "~0.5.0",
        "grunt-contrib-watch": "~0.6.1",
        "grunt-mustache": "~0.1.6",
        "grunt-newer": "^0.7.0"
    }
}

Gruntfile.js

'use strict';
module.exports = function (grunt) {
    grunt.loadNpmTasks("grunt-mustache");
    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-newer");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-contrib-copy");

    var config, sourceDir, targetDir;
    sourceDir = 'src';
    targetDir = 'build';
    config = {};
    config.pkg = grunt.file.readJSON("package.json");
    config.clean = {
        dist: [targetDir]
    };
    config.copy = {
        app: {
            files: [
                {
                    cwd: sourceDir,
                    dest: targetDir,
                    src: "**/*.js",
                    expand: true
                }
            ]
        }
    };
    config.mustache = {
        app: {
            src: sourceDir + "/**/**.mustache",
            dest: targetDir + "/templates/templates.js",
            options: {
                prefix: 'window.templates = ',
                postfix: ';',
                verbose: true
            }
        }
    };
    config.watch = {
        all: {
            options: {
                atBegin: true,
                interval: 500
            },
            files: [sourceDir + "/**/**.js", sourceDir + "/**/**.mustache"],
            tasks: ["newer:mustache:app"]
        }
    };

    grunt.initConfig(config);
    grunt.registerTask("build", ["clean", "copy", "mustache:app"]);
    grunt.registerTask("view", ["mustache"]);
    return grunt.registerTask("default", "build");
};