【发布时间】:2017-01-13 17:16:49
【问题描述】:
我在使用 gulp-angular-templatecache 时遇到了一些困难。我有一个包含任务的 gulpfile:
gulp.task('templates', function() {
return gulp.src(paths.angularTemplates)
.pipe(templateCache())
/*.pipe(gulp.dest('javascript/angular'))*/;
});
我不知道为什么,但是当管道到 gulp-angular-templatecache 并抛出时会抛出以下错误:
stream.js:74
throw er; // Unhandled stream error in pipe.
^
TypeError: Cannot read property 'toString' of null
at templateCacheFile (/home/vagrant/app/node_modules/gulp-angular-templatecache/index.js:89:40)
at wrappedMapper (/home/vagrant/app/node_modules/gulp-angular-templatecache/node_modules/event-stream/node_modules/map-stream/index.js:84:19)
at Stream.stream.write (/home/vagrant/app/node_modules/gulp-angular-templatecache/node_modules/event-stream/node_modules/map-stream/index.js:96:21)
at Stream.method [as write] (/home/vagrant/app/node_modules/gulp-angular-templatecache/node_modules/event-stream/node_modules/duplexer/index.js:47:39)
at write (/home/vagrant/app/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/home/vagrant/app/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/home/vagrant/app/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
at emitNone (events.js:67:13)
at DestroyableTransform.emit (events.js:166:7)
at emitReadable_ (/home/vagrant/app/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:448:10)
我不确定这个错误与什么问题有关。任何帮助将不胜感激。
非常感谢。
【问题讨论】:
-
嗨,你解决了吗?我刚刚在一个较旧的项目中发现了同样的问题。更新
gulp-angular-templatecache没有成功 -
是的,有一个更新的 gulp-angular-templatecache 版本破坏了它。最终在 gulpfile 中指定了特定版本
标签: javascript angularjs npm gulp