'Error: File not found with singular glob: (if this was purposeful, use `allowEmpty` option)

I am trying to automate a task with watch, in gulp. I am a beginner at this.

This is code:

const { series, src, dest, watch } = require('gulp');
const sass = require('gulp-sass');

// Función que compila SASS

function css( ) {
    return src('src/scss/app.scss')
        .pipe( sass())
        .pipe( dest('./build/css') )
}

function minificarcss() {
    return src('src/scss/app.scss')
    .pipe( sass ({
        outputStyle: 'compressed'
    }))
    .pipe( dest('./build/css') )
}

function watchArchivos() {
    watch('src/scss/**/*.scss', css ); // * = La carpeta actual - ** = Todos los archivos con esa extensión
}

exports.css = css;
exports.minificarcss = minificarcss;
exports.watchArchivos = watchArchivos;

This is the error, I have no idea why it happens, all files are well written.

Error:

PS C:\Users\Usuario\Desktop\FestivalMusica_inicio> gulp watchArchivos
[07:47:10] Using gulpfile ~\Desktop\FestivalMusica_inicio\gulpfile.js
[07:47:10] Starting 'watchArchivos'...
[07:47:41] Starting 'css'...
[07:47:41] 'css' errored after 19 ms
[07:47:41] Error: File not found with singular glob: C:/Users/Usuario/Desktop/FestivalMusica_inicio/src/scss/app.scss (if this was purposeful, use `allowEmpty` option)

The path of the directories is well written:

enter image description here



Solution 1:[1]

Confirm that the file: 'C:/Users/Usuario/Desktop/FestivalMusica_inicio/src/scss/app.scss' is written correctly. Sometimes we forget something. This problem, that's it, the file does not exist.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Helder Gonzaga