Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.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 concat jQuery抛出错误_Gulp_Gulp Concat - Fatal编程技术网

Gulp concat jQuery抛出错误

Gulp concat jQuery抛出错误,gulp,gulp-concat,Gulp,Gulp Concat,我是个新手。我试图将几个JS文件合并在一起,当我添加jQuery(或jQuery UI)时,编译器抛出错误: events.js:160 throw er; // Unhandled 'error' event ^ Error: [path]\public\components\jquery\dist\jquery.js:16:2: missing '}' 我的jQuery是通过bower(3.2.1版)的新副本,jqueryui(1.12.1版)也是如此 我的吞咽任务如下: gulp

我是个新手。我试图将几个JS文件合并在一起,当我添加jQuery(或jQuery UI)时,编译器抛出错误:

events.js:160
  throw er; // Unhandled 'error' event
  ^
Error: [path]\public\components\jquery\dist\jquery.js:16:2: missing '}'
我的jQuery是通过bower(3.2.1版)的新副本,jqueryui(1.12.1版)也是如此

我的吞咽任务如下:

gulp.task('js', function() {
    gulp.src(
        [
            config.bowerDir + '/jquery/dist/jquery.js',
            config.bowerDir + '/jquery-ui/jquery-ui.js',
            './public/js/custom.js'
        ]
    )
        .pipe(concat('script.js'))
        .pipe(gulp.dest('./public/js/'));
} );

任何帮助都将不胜感激

对不起,问题出在我自己的愚蠢。我的concat函数实际上是gulpconcat css,而不是gulpconcat。我花了三天时间才发现错误

gulp.task('js', function() {
  return gulp.src([
        config.bowerDir + '/jquery/dist/jquery.js',
        config.bowerDir + '/jquery-ui/jquery-ui.js',
        './public/js/custom.js'
    ])
    .pipe(concat('script.js'))
    .pipe(gulp.dest('./public/js/'));
});
(...)
var concat = require('gulp-concat');
(...)

gulp.task('js', function() {
    return gulp.src([
            config.bowerDir + '/jquery/dist/jquery.js',
            config.bowerDir + '/jquery-ui/jquery-ui.js',
            './public/js/custom.js'
        ])
        .pipe(concat('scripts.js'))
        .pipe(gulp.dest('./public/js/'));

对不起,这不是正确的答案。仍然得到相同的错误。我把它贴在上面。“..\jquery.js:16:2:缺少“}”。看起来gulp认为jQuery中有语法错误。我刚刚发现它对我尝试的任何JS文件都会这样做,除了空白文件。也许}曾经丢失过,即使你修复了它,jquery仍然在为旧文件提供服务。如果我没有说清楚,很抱歉,但是我没有修复任何东西。问题仍然存在。我说的唯一一件事是,我意识到丢失“}”、或丢失“、”或其他一些问题都存在于我尝试的所有文件(所有有效的JS文件)中。gulp没有报告问题的唯一一次是当我试图合并一个空白的JS文件时,否则它总是在出现“缺少[symbol]”错误时失败。