Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp-angular-templatecache no such file or directory, lstat 'templates.js' error

I have this basic setup for building my angular templates.

This is the gulpfile

var gulp = require("gulp"),
    templateCache = require('gulp-angular-templatecache');

gulp.task("tc", function() {
    return gulp
        .src("test.html")
        .pipe(templateCache()) // when I comment out this line I see test.html file is getting copied under dest folder
        .pipe(gulp.dest("dest"));
});

This is a simple html file located next to gulpfile.

<div>
    Test
</div>

When I run "gulp tc" I get below error.

[17:49:19] Using gulpfile ~SOME_PATH/gulpfile.js
[17:49:19] Starting 'tc'...
fs.js:839
  return binding.lstat(pathModule._makeLong(path));
                 ^

Error: ENOENT: no such file or directory, lstat '/SOME_PATH/templates.js'
    at Error (native)
    at Object.fs.lstatSync (fs.js:839:18)
    at DestroyableTransform.TransformStream [as _transform] (/SOME_PATH/node_modules/gulp-angular-templatecache/node_modules/gulp-header/index.js:38:12)
    at DestroyableTransform.Transform._read (/SOME_PATH/node_modules/gulp-angular-templatecache/node_modules/gulp-header/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
    at DestroyableTransform.Transform._write (/SOME_PATH/node_modules/gulp-angular-templatecache/node_modules/gulp-header/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
    at doWrite (/SOME_PATH/node_modules/gulp-angular-templatecache/node_modules/gulp-header/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:313:64)
    at writeOrBuffer (/SOME_PATH/node_modules/gulp-angular-templatecache/node_modules/gulp-header/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:302:5)
    at DestroyableTransform.Writable.write (/SOME_PATH/node_modules/gulp-angular-templatecache/node_modules/gulp-header/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:241:11)
    at write (/SOME_PATH/node_modules/gulp-concat/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
    at flow (/SOME_PATH/node_modules/gulp-concat/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)

This is as simple as a "Hello World" exercise but I cannot make it work. I tried it on mac-os, ubuntu and windows machine without any luck, always the same error. Where am I going wrong?

BTW, dependencies in the package.json look like this.

  "dependencies": {
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-angular-templatecache": "^1.8.0"
  }

EDIT: If I add an empty templates.js file to where it looks for, it works.

like image 512
Mehmet Ataş Avatar asked Jun 17 '16 14:06

Mehmet Ataş


1 Answers

https://github.com/miickel/gulp-angular-templatecache/issues/124

update gulp-header version

cheers!

like image 161
queso Avatar answered Nov 07 '22 18:11

queso