M
M
Meaningless Tea2017-02-11 11:13:10
Windows
Meaningless Tea, 2017-02-11 11:13:10

When trying to run gulp sass bash throws a typeerror: gulp.task is not a function. What is the reason?

The reason was a typo - I assigned var gulp twice, instead of var gulp and var sass.
When trying to run gulp sass through the bash, the following error is generated:

gulp.task('sass', function () {
     ^

TypeError: gulp.task is not a function
    at Object.<anonymous> (C:\Users\Jeddid\Documents\!important\mysassa\sass1\gulpfile.js:6:6)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Liftoff.handleArguments (C:\Users\Jeddid\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
    at Liftoff.<anonymous> (C:\Users\Jeddid\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js:198:16)

contents of gulpfile.js:
var gulp = require('gulp');
var gulp =  require('gulp-sass');

gulp.task('sass', function(){
  return gulp.src('source-files')
    .pipe(sass()) // Using gulp-sass
    .pipe(gulp.dest('destination'))
});

What is the reason? Google search did not return results specifically for this type of error in this context

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2017-02-11
@settheworldonfireiii

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

D
Danila, 2017-02-11
@Machinez

.pipe(sass()
close bracket, for example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question