2

We are developing a web application using AngularJS and ASP.NET Web API. There is a dev machine set up with GoCD that deploys the app after every commit to dev branch in our github repo. We are using gulp to build the frontend but after the last commit one of the tasks fails to complete.

It's pretty clear that this particular commit has nothing to do with it since it's a trivial 9 lines of css fixes. Against all logic we decided to revert but it didn't help. Gulp completes fine on Windows 10 and Linux but fails on Windows Server 2012. It's not clear why, as it was working perfectly fine for 3 months.

The task that fails:

gulp.task('partials', function () {
  return gulp.src([
    path.join(conf.paths.src, '/app/**/*.html'),
    path.join(conf.paths.tmp, '/serve/app/**/*.html')
  ])
  .pipe($.minifyHtml({
    empty: true,
    spare: true,
    quotes: true
  }))
  .pipe($.angularTemplatecache('templateCacheHtml.js', {
    module: 'portal',
    root: 'app'
  }))
  .pipe(gulp.dest(conf.paths.tmp + '/partials/'));
});

The angularTemplateCache fails with the error message that it cannot find '..src/app/templateCacheHtml.js' but this is the file that it is supposed to create and then move to '/partials/templateCacheHtml.js'.

We've tried to find some clues as to what causes it but there is nothing even remotely connected to that problem. It works perfectly on our local machines.

edo.n
  • 2,184
  • 12
  • 12

1 Answers1

4

There is an open issue on GitHub discussing this exact problem: https://github.com/miickel/gulp-angular-templatecache/issues/124

Apparently gulp-header (a dependency of gulp-angular-templatecache) was updated yesterday that seemed to break the plugin.

Add the following to your package.json:

"gulp-header": "1.8.2",

and run "npm install" should fix the problem.

  • Thanks a lot, worked like a charm. I wonder how we missed THAT github issue. – edo.n Jun 18 '16 at 08:54
  • Thankyou so much. I'm such a npm noob and was very suprised to find my previously working travis build now broken. Why doesn't npm relay on a specific eternally fixed version for dependencies (like maven?). Where can I learn more? – Matthew Jun 18 '16 at 10:33
  • @Matthew, you can make it download a specific version. There are some very nice answers [here](http://stackoverflow.com/questions/22343224/difference-between-tilde-and-caret-in-package-json). Basically, "~1.8.0" will match minor versions like 1.8.2, while "1.8.0" will match only 1.8.0 – edo.n Jun 18 '16 at 16:42