Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp-sass 5 does not have a default Sass compiler; please set one yourself

Error in plugin "gulp-sass" Message:

gulp-sass 5 does not have a default Sass compiler; please set one yourself. Both the sass and node-sass packages are permitted. For example, in your gulpfile:

var sass = require('gulp-sass')(require('sass'));

This is my code below . It says var sass = require('gulp-sass')(require('sass')); in the error but I am using import and none of the solution worked for me I am new to this and the cli version is 2.3.0 local version is 4.0.2 please give me a solution I am stuck here for days

import gulp from 'gulp';
import sass from 'gulp-sass';
import yargs from 'yargs';


const PRODUCTION = yargs.argv.prod;

export const styles = () => {
    return gulp.src('src/assets/scss/bundle.scss')
      .pipe(sass().on('error', sass.logError))
      .pipe(gulp.dest('dist/asset/css'));
}
like image 997
Zia Ansari Avatar asked Jul 17 '21 05:07

Zia Ansari


Video Answer


1 Answers

I had this problem and found that adding the standard sass npm npm install --save-dev sass and then adding the second section of the error message to my variable so that it looks like this const sass = require('gulp-sass')(require('sass')); worked.

like image 158
mattmakesnoise Avatar answered Sep 20 '22 02:09

mattmakesnoise