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

【gulp 打包css 】Error in plugin “gulp-sass“

惠文彬
2023-12-01
> npx gulp sass

[11:01:12] Using gulpfile ~/IdeaProjects/KevinDemo/mooc_ui/gulpfile.js
[11:01:12] Starting 'sass'...
Error in plugin "gulp-sass"
Message:
    
gulp-sass no longer has a default Sass compiler; please set one yourself.
Both the "sass" and "node-sass" packages are permitted.
For example, in your gulpfile:

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

[11:01:12] The following tasks did not complete: sass
[11:01:12] Did you forget to signal async completion?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mooc_ui@0.1.0 build:css: `npx gulp sass`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mooc_ui@0.1.0 build:css script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dengkai/.npm/_logs/2023-02-22T03_01_12_564Z-debug.log

提示:const sass = require('gulp-sass')(require('sass'));

首先安装下sass

npm i sass -D

然后const sass = require('gulp-sass'); 加上(require('sass')) 

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

再次打包就OK了

 类似资料: