【问题标题】:gulp-angular-templatecache fails to find the the template file it createsgulp-angular-templatecache 找不到它创建的模板文件
【发布时间】:2016-10-19 16:23:12
【问题描述】:

我们正在使用 AngularJS 和 ASP.NET Web API 开发一个 Web 应用程序。有一个使用 GoCD 设置的开发机器,它在每次提交到我们的 github 存储库中的 dev 分支后部署应用程序。我们正在使用 gulp 构建前端,但在最后一次提交后,其中一项任务无法完成。

很明显,这个特定的提交与它无关,因为它是一个微不足道的 9 行 css 修复。违背所有逻辑,我们决定恢复,但没有帮助。 Gulp 在 Windows 10 和 Linux 上运行良好,但在 Windows Server 2012 上失败。原因尚不清楚,因为它运行了 3 个月。

失败的任务:

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/'));
});

angularTemplateCache 失败并显示错误消息,它找不到“..src/app/templateCacheHtml.js”,但这是它应该创建然后移动到“/partials/templateCacheHtml.js”的文件。

我们试图找到一些线索来说明它是什么原因造成的,但没有任何东西与该问题有任何远程联系。它在我们的本地机器上完美运行。

【问题讨论】:

    标签: gulp windows-server-2012 angular-templatecache


    【解决方案1】:

    GitHub 上有一个未解决的问题正在讨论这个确切的问题:https://github.com/miickel/gulp-angular-templatecache/issues/124

    显然,昨天更新了 gulp-header(gulp-angular-templatecache 的依赖项),这似乎破坏了插件。

    将以下内容添加到您的 package.json:

    "gulp-header": "1.8.2",

    运行“npm install”应该可以解决问题。

    【讨论】:

    • 非常感谢,工作就像一个魅力。我想知道我们是怎么错过那个 github 问题的。
    • 非常感谢。我是一个 npm 菜鸟,很惊讶地发现我以前工作的 travis 构建现在坏了。为什么 npm 不依赖于特定的永久固定版本的依赖项(如 maven?)。我在哪里可以了解更多信息?
    • @Matthew,你可以让它下载一个特定的版本。有一些非常好的答案here。基本上,“~1.8.0”将匹配1.8.2等次要版本,而“1.8.0”将仅匹配1.8.0
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-10-06
    • 2017-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-01
    相关资源
    最近更新 更多