Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
397 views
in Technique[技术] by (71.8m points)

javascript - 是什么原因导致错误“ gulpSass.compiler.render不是函数”?(What's causing the error “gulpSass.compiler.render is not a function” for me?)

I'm trying to setup a gulp task using gulp-sass and when I try and run the task, I'm getting the following error:

(我正在尝试使用gulp-sass设置gulp任务,而当我尝试运行该任务时,出现以下错误:)

TypeError: gulpSass.compiler.render is not a function

Which points to index.js in the gulp-sass folder.

(指向gulp-sass文件夹中的index.js。)

gulpfile.js

(gulpfile.js)

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

sass.compiler = ('node-sass');

var cssConfig = {
    src: './wwwroot/src/sass/*.scss',
    dest: './wwwroot/dist/css/'
}

gulp.task('compileSass', function () {
     gulp.src([cssConfig.src])
         .pipe(sass().on('error', sass.logError))
         .pipe(gulp.dest([cssConfig.dest]));
});

package.json

(package.json)

  "devDependencies": {
    "gulp": "^4.0.2",
    "gulp-concat": "^2.6.1",
    "gulp-cssmin": "^0.2.0",
    "gulp-plumber": "^1.2.1",
    "gulp-sass": "^4.0.2",
    "gulp-uglify": "^3.0.2",
    "node-sass": "^4.13.0",
    "rimraf": "^3.0.0"
  },
  "dependencies": {
    "bootstrap": "^4.4.0",
    "jquery": "^3.4.1",
    "popper.js": "^1.16.0"
  }
}

Have I missed something?

(我错过了什么吗?)

So far I've stripped out all of my other tasks and reinstalled all packages just to be on the safe side.

(到目前为止,为了安全起见,我已经删除了所有其他任务,并重新安装了所有软件包。)

But no luck.

(但是没有运气。)

  ask by FullerPrime translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...