To solve gulp-sass 5 does not have a default Sass compiler error follow below methods.
Code:
var sass = require('gulp-sass')(require('sass'));
ERROR LOG
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.
In the error, it reads var sass = require(‘gulp-sass’)(require(‘sass’)); yet I’m using import and none of the solutions worked for me. I’m new at this, and the cli version is 2.3.0, while the local version is 4.0.2.
Contents
How to solve gulp-sass 5 does not have a default Sass compiler ?
The issue can be solved by 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.
Alternative to Solve gulp-sass 5 does not have a default Sass compiler
SASS must be installed.
It is also necessary to install gulp-sass.
import pkg from 'gulp';
const { src, dest, series, watch } = pkg;
import concat from 'gulp-concat'
import dartSass from 'sass'
import gulpSass from 'gulp-sass'
const sass = gulpSass(dartSass)
function scss() {
return src('app/scss/**/*.scss', { sourcemaps: true })
.pipe(sass.sync().on('error', sass.logError)) // scss to css
.pipe(concat('style.min.css'))
.pipe(dest(config.build.style, { sourcemaps: '../sourcemaps/' }))
}
async function builds() { scss() }
export { builds }
Hope the above solution works.
Also read :
Your facebook account’s off-Facebook activty in turned off
npm ERR! ERESOLVE unable to resolve dependency tree while installing npm Packages