当前位置: 首页 > 工具软件 > gulp-shell > 使用案例 >

gulp-sass提示----Error in plugin “gulp-sass“错误

彭宏义
2023-12-01

如果使用gulp4,当我们通过淘镜像或npm i install gulp去下载gulp-sass时,当我们去执行gulp sassHandler任务时会发生如下错误:

E:\HtmlExercise\SecondPhase\xiaomi>gulp sassHandler       
[20:42:54] Using gulpfile E:\HtmlExercise\SecondPhase\xiaomi\gulpfile.js
[20:42:54] Starting 'sassHandler'...
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'));

[20:42:54] The following tasks did not complete: sassHandler
[20:42:54] Did you forget to signal async completion?

解决方法

npm install sass gulp-sass --save-dev

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

具体原因可以看手册:
gulp-sass npm手册

 类似资料: