title: File not found with singular glob for a temp file
body: <p>I'm new to the Gulp system and I'm trying to get my AngularJS application up and running. Using Yeoman, I got a standard set of gulp tasks, but one of them is failing with an error message. I've narrowed it down to a specific line, but I don't know enough about this system to know what is failing or why (other than the name of the missing file, of course).</p>
  
  <p>The gulp file that's failing is as follows:</p>
  
  <pre><code>const gulp = require('gulp');
  const filter = require('gulp-filter');
  const useref = require('gulp-useref');
  const lazypipe = require('lazypipe');
  const rev = require('gulp-rev');
  const revReplace = require('gulp-rev-replace');
  const uglify = require('gulp-uglify');
  const cssnano = require('gulp-cssnano');
  const htmlmin = require('gulp-htmlmin');
  const sourcemaps = require('gulp-sourcemaps');
  const uglifySaveLicense = require('uglify-save-license');
  const ngAnnotate = require('gulp-ng-annotate');
  
  const conf = require('../conf/gulp.conf');
  
  gulp.task('build', build);
  
  function build() {
    const htmlFilter = filter(conf.path.tmp('*.html'), {restore: true});
    const jsFilter = filter(conf.path.tmp('**/*.js'), {restore: true});
    const cssFilter = filter(conf.path.tmp('**/*.css'), {restore: true});
  
    return gulp.src(conf.path.tmp('/index.html'))
      .pipe(useref({}, lazypipe().pipe(sourcemaps.init, {loadMaps: true})))
      // .pipe(jsFilter)
      // .pipe(ngAnnotate())
      // .pipe(uglify({preserveComments: uglifySaveLicense})).on('error', conf.errorHandler('Uglify'))
      // .pipe(rev())
      // .pipe(jsFilter.restore)
      // .pipe(cssFilter)
      // .pipe(cssnano())
      // .pipe(rev())
      // .pipe(cssFilter.restore)
      // .pipe(revReplace())
      // .pipe(sourcemaps.write('maps'))
      // .pipe(htmlFilter)
      // .pipe(htmlmin())
      // .pipe(htmlFilter.restore)
      // .pipe(gulp.dest(conf.path.dist()));
  }
  </code></pre>
  
  <p>As you can see, I've commented out all but the offending line. That line, when called as part of the build process produces the following error message:</p>
  
  <pre><code>[17:22:27] 'build' errored after 42 ms
  [17:22:27] Error: Error: File not found with singular glob: C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\.tmp\jspm_packages\system.js
  at DestroyableTransform.&lt;anonymous&gt; (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\gulp-useref\index.js:65:28)
  at emitOne (events.js:101:20)
  at DestroyableTransform.emit (events.js:188:7)
  at emitOne (events.js:101:20)
  at Through2.emit (events.js:188:7)
  at OrderedStreams.&lt;anonymous&gt; (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\glob-stream\index.js:140:20)
  at emitOne (events.js:96:13)
  at OrderedStreams.emit (events.js:188:7)
  at emitOne (events.js:96:13)
  at DestroyableTransform.emit (events.js:188:7)
  at Glob.&lt;anonymous&gt; (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\glob-stream\index.js:40:16)
  at Glob.g (events.js:286:16)
  at emitOne (events.js:96:13)
  at Glob.emit (events.js:188:7)
  at Glob._finish (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\glob-stream\node_modules\glob\glob.js:172:8)
  at done (C:\Users\Jeffrey Getzin\Documents\GitHubVisualStudio\newclient\node_modules\glob-stream\node_modules\glob\glob.js:159:12)
  [17:22:27] 'build' errored after 25 s
  [17:22:27] 'default' errored after 25 s
  [17:22:27] 'serve:dist' errored after 25 s
  
   Process finished with exit code 1
  </code></pre>
  
  <p>Obviously, it's looking for system.js in a temporary copy of the jspm packages, but <i>why?</i>  And why is it not finding it? Should the file be there? I don't know what the gulp script is trying to do, so I couldn't hazard a guess as to why it's not working.</p>
  
  <p>I know this is probably not enough information for a comprehensive answer, but I'm hoping there's enough here for you to at least point me in the right direction. </p>
  
  <p>Thanks!</p>
  
  <p><strong>Update 1/3/2017</strong></p>
  
  <p>I've kinda-sorta figured out what useref is supposed to do. My index.html file is</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;base href="/"&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;FountainJS&lt;/title&gt;
      &lt;meta name="description" content=""&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;link rel="icon" type="image/png" href="http://fountainjs.io/assets/imgs/fountain.png" /&gt;
      &lt;!-- Latest compiled and minified CSS --&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"&gt;
      &lt;link rel="stylesheet" href="css/camera.css" type="text/css" media="screen"&gt;
      &lt;link rel="stylesheet" href="css/style.css" type="text/css" media="screen"&gt;
  
      &lt;!-- build:css(.tmp) index.css --&gt;
      &lt;link rel="stylesheet" href="index.css"&gt;&lt;/link&gt;
      &lt;!-- endbuild --&gt;
    &lt;/head&gt;
  
    &lt;body class="front" ng-app="app"&gt;
      &lt;div id="main"&gt;
        &lt;ui-view&gt;&lt;/ui-view&gt;
        &lt;page-footer&gt;&lt;/page-footer&gt;
      &lt;/div&gt;
    &lt;/body&gt;
  
    &lt;!-- build:js(.tmp) index.js --&gt;
    &lt;script src="jspm_packages/system.js"&gt;&lt;/script&gt;
    &lt;script src="jspm.browser.js"&gt;&lt;/script&gt;
    &lt;script src="jspm.config.js"&gt;&lt;/script&gt;
  
    &lt;script&gt;
      System.import('src/index.ts');
    &lt;/script&gt;
    &lt;!-- endbuild --&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>What I think is <em>supposed</em> to happen is that it's supposed to replace the block:</p>
  
  <pre><code>  &lt;!-- build:js(.tmp) index.js --&gt;
    &lt;script src="jspm_packages/system.js"&gt;&lt;/script&gt;
    &lt;script src="jspm.browser.js"&gt;&lt;/script&gt;
    &lt;script src="jspm.config.js"&gt;&lt;/script&gt;
  
    &lt;script&gt;
      System.import('src/index.ts');
    &lt;/script&gt;
    &lt;!-- endbuild --&gt;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>  &lt;script src="tmp/index.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Does this sound correct?</p>