Why does not Gulp run?

Hi, I’m trying to run gulp on my project and I get an error.
It is a project of several modules: db, frontent, client, etc; is entirely built with javascript, Node.js
So far it works well, but I stop doing it.
When running “npm run build” I should run Gulp, and save the styles, but since it does not, I can not continue, because it does not take the changes I made and I can not continue with my application.
I show the error, the file Gulpfile.js and the package.json, in case you can help me.
I have tried several ideas searched by google, but nothing works until now.
Thank you.

> gulp

  throw new errors.AssertionError({

AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask] (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/undertaker/lib/set-task.js:10:3)
    at Gulp.task (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/undertaker/lib/task.js:13:8)
    at Object.<anonymous> (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/Gulpfile.js:68:6)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
npm ERR! errno 1
npm ERR! michaelgram@0.1.0 build: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the michaelgram@0.1.0 build script.

//  This is the code of my Gulpfile.js file

var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var babel = require('babelify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var watchify = require('watchify');

gulp.task('styles', function () {

gulp.task('assets', function () {

function compile(watch) {
  var bundle = browserify('./src/index.js', {debug: true});

  if (watch) {
    bundle = watchify(bundle);
    bundle.on('update', function () {
      console.log('--> Bundling...');

  function rebundle() {
      .transform(babel, { presets: [ 'es2015' ], plugins: [ 'syntax-async-functions', 'transform-regenerator' ] })
      .on('error', function (err) { console.log(err); this.emit('end') })


gulp.task('build', function () {
  return compile();

gulp.task('watch', function () { return compile(true); });

gulp('default',('styles', 'assets', 'build'));


  "name": "michaelgram",
  "version": "0.1.0",
  "description": "Programa para compartir fotos con tus amigos",
  "main": "server.js",
  "keywords": [

  "author": "Miguel Espeso",
  "license": "MIT",
  "dependencies": {
    "aws-sdk": "^2.250.1",
    "axios": "^0.18.0",
    "babel-polyfill": "^6.26.0",
    "body-parser": "^1.18.3",
    "cookie-parser": "^1.4.3",
    "empty-element": "^1.0.0",
    "express": "^4.16.3",
    "express-session": "^1.15.6",
    "file-extension": "^4.0.2",
    "intl": "^1.2.5",
    "intl-messageformat": "^2.2.0",
    "intl-relativeformat": "^2.1.0",
    "materialize-css": "^0.100.2",
    "michaelgram-client": "file:../michaelgram-client",
    "minimatch": "^3.0.4",
    "multer": "^1.3.0",
    "multer-s3": "^2.7.0",
    "node-pre-gyp": "^0.9.1",
    "page": "^1.8.6",
    "passport": "^0.4.0",
    "passport-facebook": "^2.1.1",
    "passport-local": "^1.0.0",
    "pug": "^2.0.3",
    "readable-stream": "^2.3.6",
    "superagent": "^3.8.3",
    "title": "^3.2.0",
    "vinyl-source-stream": "^2.0.0",
    "yo-yo": "^1.4.1"
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-plugin-syntax-async-functions": "^6.13.0",
    "babel-plugin-transform-regenerator": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-es2015": "^6.24.1",
    "babelify": "^8.0.0",
    "browserify": "^16.2.0",
    "gulp": "^4.0.0",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^4.0.1",
    "watchify": "^3.11.0",
    "webpack": "^2.7.0"
  "scripts": {
    "build": "gulp",
    "watch": "gulp watch",
    "postinstall": "npm run build",
    "start": "node server.js"

Can you try unintalling your gulp and reinstalling it again?

1 Like

Thanks, I’m doing what you told me to see if it works …

I did what you suggested, but I get the following error when running “npm run build”

 npm run build

> michaelgram@0.1.0 build /home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram
> gulp

  return binding.readdir(pathModule._makeLong(path), options.encoding);

Error: ENOENT: no such file or directory, scandir '/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/node-sass/vendor'
    at Object.fs.readdirSync (fs.js:904:18)
    at Object.getInstalledBinaries (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/node-sass/lib/extensions.js:129:13)
    at foundBinariesList (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (/home/miguel/CURSOS/javascript-node/nuevoProyecto/michaelgram/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)

Hello, I think it solves the problem, at least for the moment.
After round and round, start that module again.
Well, by installing another module again, npm gives me vulnerabilities and requested GULP 4.
Well, after installing Gulp4, it stops working and gives the error that it shows.
So I installed Gulp3 … and it works perfectly.
Thanks for the support.

This problem occurs because gulp version 4 changed the syntax of gulpfile.js.

You must write the code as follows:

earlier than version 4 in your task:
gulp.task (‘sass’, function () {
Your code here

after version 4 in your task:
gulp.task (‘sass’, gulp.series (function () {


Repair tag closing

watch before version 4:
'ulp.watch (‘App / sass / ** / *. scss’, [‘sass’]);

after version 4:
gulp.watch (‘Assets / sass / ** / *. scss’, gulp.parallel ([‘sass’]));