Javascript 在Grunt中使用MinPrepare Sprowing pattern.indexOf error

Javascript 在Grunt中使用MinPrepare Sprowing pattern.indexOf error,javascript,gruntjs,grunt-usemin,Javascript,Gruntjs,Grunt Usemin,运行grunt build命令时,出现以下错误: 警告:pattern.indexOf不是一个函数使用--强制继续。 由于警告而中止。 关于我做错了什么有什么建议吗?我发现了一个类似的帖子: 我已经尝试了发布在那里的解决方案,但没有成功 我的GruntScript.js文件如下: "use strict"; module.exports = function (grunt) { const sass = require('node-sass'); req

运行
grunt build
命令时,出现以下错误:

警告:pattern.indexOf不是一个函数使用--强制继续。

由于警告而中止。

关于我做错了什么有什么建议吗?我发现了一个类似的帖子: 我已经尝试了发布在那里的解决方案,但没有成功

我的GruntScript.js文件如下:

"use strict";

module.exports = function (grunt) {

    const sass = require('node-sass');

    require("time-grunt")(grunt);

    require("jit-grunt")(grunt, {
        useminPrepare: "grunt-usemin"
    });

    grunt.initConfig({
        sass: {
            dist: {
                files: {
                    "css/styles.css": "css/styles.scss"
                }
            }
        },
        watch: {
            files: "css/*.scss", 
            tasks: ["sass"]
        },
        browserSync: {
            dev: {
                bsFiles: {
                    src: [
                        "css/*.css",
                        "*.html",
                        "js/*.js"
                    ]
                },
                options: {
                    implementation: sass,
                    sourceMap: true,
                    watchTask: true,
                    server: {
                        baseDir: "./"
                    }
                }

            }

        },
        copy: {
            html: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: "./",
                    src: ["*.html"],
                    dest: "dist"
                }]
            },
            fonts: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: "node_modules/font-awesome",
                    src: ["fonts/*.*"],
                    dest: "dist"
                }]
            }
        },
        clean: {
            build: {
                src: ["dist/"]
            }
        },
        imagemin: {
            dynamic: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: "./",
                    src: ["img/*.{png,jpg,gif}"],
                    dest: "dist/"
                }]
            }
        },
        useminPrepare: {
            foo: {
                dest: "dist",
                src: ["contactus.html", "aboutus.html", "index.html"]
            },
            options: {
                flow: {
                    steps: {
                        css: ["cssmin"],
                        js: ["uglify"]
                    },
                    post: {
                        css: [{
                            name: "cssmin",
                            createConfig: function (context, block){
                            var generated = context.options.generated;
                                generated.options = {
                                    keepSpecialComments: 0, rebase: false
                                };
                            }
                        }]
                    }
                }
            }
        },
        concat: {
            options: {
                separator: ";"
            },
            dist: {}
        },
        uglify: {
            dist: {}
        },
        cssmin: {
            dist: {}
        },
        filerev: {
            options: {
                encoding: "utf8",
                algorithm: "md5",
                length: 20
            },
            release: {
                files: [{
                    src: [
                        "dist/js/*.js",
                        "dist/css/*.css",
                    ]
                }]
            }
        },
        usemin: {
            html: ["dist/contactus.html", "dist/aboutus.html", "dist/index.html"],
            options: {
                assetsDirs: ["dist", "dist/css", "dist/js"]
            }
        },
        htmlmin: {
            dist: {
                options: {
                    collapseWhitespace: true
                },
                files: {
                    "dist/index.html": "dist/index.html",
                    "dist/contactus.html": "dist/contactus.html",
                    "dist/aboutus.html": "dist/aboutus.html",
                }
            }
        }

    });

    grunt.registerTask("css", ["sass"]);
    grunt.registerTask("default", ["browserSync", "watch"]);
    grunt.registerTask("build", [
        "clean",
        "copy",
        "imagemin",
        "useminPrepare",
        "concat",
        "cssmin",
        "uglify",
        "filerev",
        "usemin",
        "htmlmin"
    ]);

};