运行gulp build时“没有这样的文件或目录/src/app/templateCacheHtml.js”

时间:2016-06-17 21:05:11

标签: angularjs generator-gulp-angular

我正在使用gulp-angular yeoman生成器,如果我创建一个新项目,然后运行gulp build或gulp serve:dist我得到了这个错误:

每当我尝试构建项目时,都会收到此错误:

  

[16:03:56] gulp-injection 2个文件到index.less。 fs.js:887回归   binding.lstat(pathModule._makeLong(路径)); ^

     

错误:ENOENT:没有这样的文件或目录,lstat   '/Users/danielrvt/IdeaProjects/rztest/src/app/templateCacheHtml.js'at at   在Object.fs.lstatSync(fs.js:887:18)处的错误(本机)   DestroyableTransform.TransformStream为_transform at   DestroyableTransform.Transform.read   (/Users/danielrvt/IdeaProjects/rztest/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)   在DestroyableTransform.Transform._write   (/Users/danielrvt/IdeaProjects/rztest/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)   在doWrite   (/Users/danielrvt/IdeaProjects/rztest/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:313:64)   在writeOrBuffer   (/Users/danielrvt/IdeaProjects/rztest/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:302:5)   在DestroyableTransform.Writable.write   (/Users/danielrvt/IdeaProjects/rztest/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:241:11)   在写   (/Users/danielrvt/IdeaProjects/rztest/node_modules/gulp-concat/node_modules/readable-stream/lib/_stream_readable.js:623:24)   在流动   (/Users/danielrvt/IdeaProjects/rztest/node_modules/gulp-concat/node_modules/readable-stream/lib/_stream_readable.js:632:7)   在DestroyableTransform.pipeOnReadable   (/Users/danielrvt/IdeaProjects/rztest/node_modules/gulp-concat/node_modules/readable-stream/lib/_stream_readable.js:664:5)   在DestroyableTransform.emit的emitNone(events.js:80:13)   (events.js:179:7)在emitReadable   (/Users/danielrvt/IdeaProjects/rztest/node_modules/gulp-concat/node_modules/readable-stream/lib/_stream_readable.js:448:10)   在emitReadable   (/Users/danielrvt/IdeaProjects/rztest/node_modules/gulp-concat/node_modules/readable-stream/lib/_stream_readable.js:444:5)   在readableAddChunk   (/Users/danielrvt/IdeaProjects/rztest/node_modules/gulp-concat/node_modules/readable-stream/lib/_stream_readable.js:187:9)

1 个答案:

答案 0 :(得分:12)

修复

问题#37中包含的修复程序已经发布,因此不再需要以下解决方法。执行npm update后,错误不应再出现。

原因

此错误是由gulp-header库中的最新更新(v1.8.3)引起的。

已创建issue供您跟踪。

gulp-angular-templatecache间接依赖gulp-header,在一些评论中提到了这一点。

解决方法

在发布修复程序之前,您可以将先前版本的gulp-header的节点依赖项添加到package.json。但是,机票已经关闭,因此很快就会发布。

"dependencies": {
    "gulp-header": "1.8.2"
}