title: gulp-usemin TypeError: Path must be a string. Received undefined
body: <p>I'm using gulp-usemin for minify the javascript files I use in my app, for some reason gulp is not seeing one of my files. I have this in my index.html:</p>
  
  <pre><code>&lt;body ng-app="App"&gt;
      &lt;!--[if lte IE 8]&gt;
        &lt;p class="browsehappy"&gt;You are using an &lt;strong&gt;outdated&lt;/strong&gt; browser. Please &lt;a href="http://browsehappy.com/"&gt;upgrade your browser&lt;/a&gt; to improve your experience.&lt;/p&gt;
      &lt;![endif]--&gt;
  
      &lt;div&gt;
          &lt;ui-view&gt;&lt;/ui-view&gt;
      &lt;/div&gt;
  
      &lt;div class="footer"&gt;
          &lt;div class="container"&gt;
              &lt;!-- TODO: add fotter here --&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;!-- build:js(.) scripts/scripts.js--&gt;
      &lt;script src="bower_components/jquery/dist/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="bower_components/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="bower_components/angular/angular.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="bower_components/angular-ui-router/release/angular-ui-router.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="bower_components/angular-bootstrap/ui-bootstrap-tpls-0.14.3.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;!-- endbuild --&gt;
  
      &lt;!-- build:js({.tmp,app}) --&gt;
      &lt;script src="scripts/app.js"&gt;&lt;/script&gt;
      &lt;script src="scripts/routes.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="scripts/controllers/controller1.js" type="text/javascript"&gt;&lt;/script&gt;        
      &lt;script src="scripts/controllers/controller2.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="scripts/services/service1.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="scripts/services/service2.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="scripts/directives/directive1/directive1.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="scripts/directives/directive2/directive2.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;!-- endbuild --&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>And this is my gulpfile.js:</p>
  
  <pre><code>// Generated on 2015-12-16 using generator-angular 0.15.1
  'use strict';
  
  var gulp = require('gulp'),
      usemin = require('gulp-usemin'),
      wrap = require('gulp-wrap'),
      connect = require('gulp-connect'),
      watch = require('gulp-watch'),
      minifyCss = require('gulp-minify-css'),
      minifyJs = require('gulp-uglify'),
      concat = require('gulp-concat'),
      less = require('gulp-less'),
      rename = require('gulp-rename'),
      minifyHTML = require('gulp-minify-html'),
      zip = require('gulp-zip');
  
  var paths = {
      scripts: 'app/scripts/**/*.*',
      styles: 'app/styles/**/*.less',
      custom_css: 'app/styles/**/*.css',
      custom_fonts: 'fonts/**/*.{ttf,woff,eof,svg}',
      images: 'app/images/**/*.*',
      templates: 'app/views/**/*.html',
      index: 'app/index.html',
      bower_fonts: 'bower_components/**/*.{ttf,woff,eof,svg}',
      customstyle:'bower_components/bootstrap/dist/css/bootstrap.min.css'
  };
  
  var logerror = function(e){ console.log(e); };
  
  /**
   * Handle bower components from index
   */
  gulp.task('usemin', function() {
      return gulp.src(paths.index)
          .pipe(usemin({
              js: [minifyJs().on('error', function(e){ console.log(e); }),         'concat'],
              css: [minifyCss({keepSpecialComments: 0}), 'concat']
          }))
          .pipe(gulp.dest('dist/'));
  });
  
  gulp.task('zip', function () {
      return gulp.src(['dist/**/*.*', '!dist/dist.zip', '!dist/index.html'])
          .pipe(zip('dist.zip'))
          .pipe(gulp.dest('dist/'));
  });
  
  /**
   * Copy assets
   */
  gulp.task('build-assets', ['copy-bower_fonts', 'custom-less', 'custom-    css']);
  
  gulp.task('copy-bower_fonts', function() {
      return gulp.src(paths.bower_fonts)
          .pipe(rename({
              dirname: '/fonts'
          }))
          .pipe(gulp.dest('dist/'));
  });
  
  gulp.task('custom-less', function() {
      return gulp.src(paths.styles)
          .pipe(less())
          .pipe(gulp.dest('dist/styles'));
  });
  
  gulp.task('custom-css', function() {
      return gulp.src(paths.custom_css)
          .pipe(minifyCss())
          .pipe(concat('custom.min.css'))
          .pipe(gulp.dest('dist/styles'));
  });
  
  gulp.task('copy-templates', function() {
      return gulp.src(paths.templates)
          .pipe(minifyHTML().on('error',logerror))
          .pipe(gulp.dest('dist/views'));
  });
  
  /**
   * Watch custom files
   */
  gulp.task('watch', function() {
      gulp.watch([paths.index], ['usemin']);
      gulp.watch([paths.customstyle], ['usemin']);
      gulp.watch([ 'dist/**/*.*', '!dist/dist.zip', '!dist/index.html'], ['zip']);
  });
  
  /**
   * Live reload server
   */
  gulp.task('webserver', function() {
      connect.server({
          root: 'dist',
          livereload: true,
          port: 8888
      });
  });
  
  gulp.task('livereload', function() {
      gulp.src(['dist/**/*.*'])
          .pipe(watch())
          .pipe(connect.reload());
  });
  
  /**
   * Gulp tasks
   */
  gulp.task('build', ['build-assets','copy-templates', 'usemin']);
  gulp.task('default', ['build', 'zip']);
  gulp.task('run', ['build', 'webserver', 'livereload', 'watch']);
  </code></pre>
  
  <p>When I run default task I get this message: </p>
  
  <blockquote>
    <p>TypeError: Path must be a string. Received undefined</p>
  </blockquote>
  
  <p>If I remove <code>&lt;script src="scripts/directives/directive2/directive2.js"     type="text/javascript"&gt;&lt;/script&gt;</code> from the index the gulp task run without errors and I'm pretty sure the file is there and url is written correctly.</p>
  
  <p>Please help!!</p>