Reputation: 49
gulp-htmlmin
throwing err like
events.js:183
throw er; // Unhandled 'error' event
^
Error: Parse Error: <!-- END PAGE CONTENT WRAPPER
This same code work with other project but when I'm running gulp it is throwing error like this. How can I resove this.
here, my gulp file code
let gulp = require('gulp');
let htmlmin = require('gulp-htmlmin');
//Pages
gulp.task('pages', function () {
gulp.src(['./src/**/*html'])
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true
}))
.pipe(gulp.dest('./public'));
});
gulp.task('default', ['pages']);
Can anyone help?
Thanks in advance.
Upvotes: 1
Views: 2198
Reputation: 49
Thank you all for comments and answer.
I got the solution. I've re-install all node modules (as per Joe Rushton
's suggestion) and add gulp-util
module to track error. I've found <!-- END PAGE CONTENT WRAPPER
is unfinished comment in HTML file, it should be like <!-- END PAGE CONTENT WRAPPER -->
.
Upvotes: 1
Reputation: 51
If the code is working on other machines it’s usually either:
One of the gulp dependencies doesn’t work with your version of node. Type node -v into your terminal and compare that with your coworkers. I’d recommend the LTS version of node as it’s the most stable
Somewhere down the line your node_modules became corrupt. Try deleting the entire node_modules directory and run npm install
Upvotes: 1