运行gulp时出现解析错误

4

I get the following error in my command terminal whenever run gulp to minify JavaScript files.I checked all the files listed below but I don't seem to find any error.The error message is below: events.js:182 throw er; // Unhandled 'error' event ^ Error: Parse Error:

at new HTMLParser (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\html-minifier\src\htmlparser.js:236:13)    at minify (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\html-minifier\src\htmlminifier.js:861:3)
at Object.exports.minify (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\html-minifier\src\htmlminifier.js:1216:10)
at objectAssign.fileName (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\gulp-htmlmin\index.js:22:39)
at module.exports (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\tryit\tryit.js:8:9)
at minifyHtml (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\gulp-htmlmin\index.js:21:9)
at Transform.htmlminTransform [as _transform] (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\gulp-htmlmin\index.js:51:7)
at Transform._read (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\gulp-htmlmin\node_modules\readable-stream\lib\_stream_transform.js:182:10)
at Transform._write (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\gulp-htmlmin\node_modules\readable-stream\lib\_stream_transform.js:170:83)
at doWrite (C:\wamp64\www\webportaluser\viewvendingAdmin\node_modules\gulp-htmlmin\node_modules\readable-stream\lib\_stream_writable.js:406:64)

1个回答

1
您可以使用以下格式查找导致错误的代码行。
gulp.task('scripts', ['clean'], function () {
  return gulp.src('js/*.js')
    .pipe(uglify().on('error', function(e){
        console.log(e);
     }))
    .pipe(gulp.dest('minjs'));
});

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接