R
R
Roman Tankov2017-02-21 12:20:48
Node.js
Roman Tankov, 2017-02-21 12:20:48

Why did gulp stop running?

Hello! Stopped running gulp
Error on all projects is the same.

Running 'default'...
module.js:474
    throw err;
    ^

Error: Cannot find module 'internal/fs'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at evalmachine.<anonymous>:17:20
    at Object.<anonymous> (D:\newfytbolkin\node_modules\gulp\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:11:1)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)

gulpfile.js
global.hostname = "localhost";

var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename');

gulp.task('express', function() {
  var express = require('express');
  var app = express();
  app.use(require('connect-livereload')({port: 35729}));
  app.use(express.static(__dirname + '/app'));
  app.listen('80', hostname);
});

var tinylr;
gulp.task('livereload', function() {
  tinylr = require('tiny-lr')();
  tinylr.listen(35729);
});

function notifyLiveReload(event) {
  var fileName = require('path').relative(__dirname, event.path);
  tinylr.changed({
    body: {
      files: [fileName]
    }
  });
}

gulp.task('styles', function () {
  gulp.src('sass/*.sass')
  .pipe(sass({
    includePaths: require('node-bourbon').includePaths
  }).on('error', sass.logError))
  .pipe(rename({suffix: '.min', prefix : '_'}))
  .pipe(autoprefixer({
    browsers: ['last 15 versions'],
    cascade: false
  }))
  .pipe(minifycss())
  .pipe(gulp.dest('app'));
});

gulp.task('watch', function() {
  gulp.watch('sass/*.sass', ['styles']);
  gulp.watch('app/*.css', notifyLiveReload);
  gulp.watch('app/*.html', notifyLiveReload);
});

gulp.task('default', ['styles', 'express', 'livereload', 'watch'], function() {

});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Khokhlov, 2017-02-21
@andrhohlov

Have you tried the solution from here ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question