Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gulp uglify-uglify函数抛出错误_Gulp_Browserify_Gulp Uglify - Fatal编程技术网

Gulp uglify-uglify函数抛出错误

Gulp uglify-uglify函数抛出错误,gulp,browserify,gulp-uglify,Gulp,Browserify,Gulp Uglify,我试图用“gulp uglify”来丑化一些javascript文件:“3.0.0”,但不断收到错误消息。在捆绑这些文件之前,我还使用了browserify gulp文件中的代码: var b = browserify({ entries: file, debug: true }); return b.bundle() .pipe(source(file)) .pipe(buffer()) .pipe(uglify().on('error', function (e) { console.lo

我试图用“gulp uglify”来丑化一些javascript文件:“3.0.0”,但不断收到错误消息。在捆绑这些文件之前,我还使用了browserify

gulp文件中的代码:

var b = browserify({
entries: file,
debug: true
});

return b.bundle()
.pipe(source(file))
.pipe(buffer())
.pipe(uglify().on('error', function (e) {
console.log(e);
}))
.pipe(rename(file.replace(/^Views/, '')))
.pipe(gulp.dest('./dist/js'));
任务运行程序控制台输出中引发的错误:

{ [GulpUglifyError: unable to minify JavaScript]
cause: 
   { [SyntaxError: Unexpected token: punc ())]
     message: 'Unexpected token: punc ())',
     filename: 'Views\\AccountDetails\\ContactDetails.js',
     line: 1547,
     col: 25,
     pos: 50851 },
  plugin: 'gulp-uglify',
  fileName: 'C:\\_src\\RETIG\\My.TONIKSpace\\My.TonikSpace\\Views\\AccountDetails\\ContactDetails.js',
  showStack: false }
{ [GulpUglifyError: unable to minify JavaScript]
  cause: 
   { [SyntaxError: Unexpected token: punc ())]
     message: 'Unexpected token: punc ())',
     filename: 'Views\\AccountDetails\\DirectDebitDetails.js',
     line: 73,
     col: 3,
     pos: 2086 },
  plugin: 'gulp-uglify',
  fileName: 'C:\\_src\\RETIG\\My.TONIKSpace\\My.TonikSpace\\Views\\AccountDetails\\DirectDebitDetails.js',
  showStack: false }
{ [GulpUglifyError: unable to minify JavaScript]
  cause: 
   { [SyntaxError: Unexpected character '`']
     message: 'Unexpected character \'`\'',
     filename: 'Views\\Usage\\Index.js',
     line: 157,
     col: 11,
     pos: 4109 },
  plugin: 'gulp-uglify',
  fileName: 'C:\\_src\\RETIG\\My.TONIKSpace\\My.TonikSpace\\Views\\Usage\\Index.js',
  showStack: false }
{ [GulpUglifyError: unable to minify JavaScript]
  cause: 
Process terminated with code 0.
   { [SyntaxError: Unexpected token: punc ())]
     message: 'Unexpected token: punc ())',
     filename: 'Views\\SharedAccounts\\Index.js',
     line: 183,
     col: 4,
     pos: 5991 },
  plugin: 'gulp-uglify',
  fileName: 'C:\\_src\\RETIG\\My.TONIKSpace\\My.TonikSpace\\Views\\SharedAccounts\\Index.js',
  showStack: false }
{ [GulpUglifyError: unable to minify JavaScript]
  cause: 
   { [SyntaxError: Unexpected token: punc ())]
     message: 'Unexpected token: punc ())',
     filename: 'Views\\AccountDetails\\Index.js',
     line: 1547,
     col: 25,
     pos: 50851 },
  plugin: 'gulp-uglify',
  fileName: 'C:\\_src\\RETIG\\My.TONIKSpace\\My.TonikSpace\\Views\\AccountDetails\\Index.js',
  showStack: false }
</code>

我试图通过更改错误所指的标点符号来解决这些错误,但这感觉不对。无论我使用单引号还是双引号,gulp为什么不只是对文件进行丑化处理?

可能的重复内容看起来您使用的是不支持ES6的丑化版本的ES6。请参阅复制链接。可能的复制看起来您正在使用不支持ES6的丑陋版本的ES6。请参阅复制链接。