Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/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 如何修复';无法获取/';BrowseSync出错?_Gulp_Gulp Watch_Gulp Sass - Fatal编程技术网

Gulp 如何修复';无法获取/';BrowseSync出错?

Gulp 如何修复';无法获取/';BrowseSync出错?,gulp,gulp-watch,gulp-sass,Gulp,Gulp Watch,Gulp Sass,我正在使用一个Gulp设置,它将监视我的HTML、Sass和文件。如何解决下面的错误 得不到/ 这是我的代码: //Watch Files htmlWatchFiles = './src/html/main/*.html'; //Input files // File for gulp-sass compiler var inputScssFile = './src/stylesheets/**/*.scss' function sassCompiler() { return gu

我正在使用一个Gulp设置,它将监视我的HTML、Sass和文件。如何解决下面的错误

得不到/

这是我的代码:

//Watch Files
htmlWatchFiles = './src/html/main/*.html';

//Input files
//  File for gulp-sass compiler
var inputScssFile = './src/stylesheets/**/*.scss'

function sassCompiler() {
    return gulp.src(inputScssFile)
      .pipe(sass())
      .pipe(autoPrefixer())
      .pipe(dest('./src/stylesheets/output'))
      .pipe(browserSync.stream());
}
以下是我要观看的功能:

function toBrowseSync(){
    browserSync.init({
        server: {
            baseDir: "src/",
            index:"./src/html/main/index/html"
        }
    });
    gulp.watch(inputScssFile,sassCompiler);
    gulp.watch(htmlWatchFiles).on('change', browserSync.reload);
}

exports.default = series(sassCompiler,toBrowseSync);

对于BrowserSync配置,索引属性中使用的路径应与使用的baseDir相对。文档还在代码注释中提到了这一点

browserSync.init({
    server: {
        baseDir: "src/",
        index:"html/main/index.html"
    }
});

@斯蒂芬斯(干得好)@StephenS,现在你能帮我解决问题吗?你试过这个吗?看起来是同一个问题: