Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ENOENT: no such file or directory, open 'target/tmp/templates.js' #169

Open
Soumya-mp opened this issue Dec 3, 2018 · 1 comment

Comments

@Soumya-mp
Copy link

I am running a gulp build for production. I am getting an error "Error: ENOENT: no such file or directory, open 'target/tmp/templates.js'". This is a snippet of gulpfile.js and gulp/build.js files
GULPFILE.JS

gulp.task('html', function () {
return gulp.src(config.app + 'app/**/*.html')
.pipe(print())
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(templateCache('templates.js', {
module: 'mommypowerApp',
root: 'app/',
moduleSystem: 'IIFE',
}))
.pipe(gulp.dest(config.tmp));
});
GULP/BUILD.JS

module.exports = function() {
var templates = fs.readFileSync(config.tmp + '/templates.js');
var manifest = gulp.src(config.revManifest);

return gulp.src([config.app + '**/*.html',
    '!' + config.app + 'app/**/*.html',
    '!' + config.app + 'swagger-ui/**/*',
    '!' + config.bower + '**/*.html'])
    .pipe(print())
    .pipe(plumber({errorHandler: handleErrors}))
    //init sourcemaps and prepend semicolon
    .pipe(useref({}, initTask))
    //append html templates
    .pipe(gulpIf('**/app.js', footer(templates)))
    .pipe(gulpIf('*.js', jsTask()))
    .pipe(gulpIf('*.css', cssTask()))
    .pipe(gulpIf('*.html', htmlmin({collapseWhitespace: true})))
    .pipe(gulpIf('**/*.!(html)', rev()))
    .pipe(revReplace({manifest: manifest}))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest(config.dist));

};

Not able to understand why the templates.js file fails to get created. I saw in one of posts in GitHub forum that in the package.json file I should include gulp-header before gulp-angular-templatecache. After modifying this I uninstalled the gulp-angular-templatecache and ran npm-install. Even after doing this getting the same error.

@happyplayer1991
Copy link

Hi @Soumya-mp
I have the same issue.
Have you fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants