【问题标题】:gulp-angular-templatecache throwing error when piping angular templates管道角度模板时 gulp-angular-templatecache 抛出错误
【发布时间】: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


【解决方案1】:

有一个更新的 gulp-angular-templatecache 版本破坏了它。最终在 gulpfile 中指定了特定版本

【讨论】:

    【解决方案2】:

    在我的项目中,这是由一个带有点的文件夹名称引起的。 因此,我有一个名为 folder_name.html 的文件夹,我不得不将其重命名为 folder_name。

    (使用 gulp-angular-templatecache 版本 1.9.1)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-18
      • 1970-01-01
      • 1970-01-01
      • 2015-10-06
      • 2017-08-21
      • 2016-10-19
      • 2015-08-01
      • 1970-01-01
      相关资源
      最近更新 更多