M
M
Maxim2020-03-14 15:43:18
gulp.js
Maxim, 2020-03-14 15:43:18

Why is Gulp not finding connected modules?

There is a gulpfile:

const gulp = require('gulp');
const lesstocss = require('./gulp/tasks/style');
const includetohtml = require('./gulp/tasks/include');
const svgsprite = require('./gulp/tasks/sprite');
const minifyImg = require('./gulp/tasks/imagemin');
const fonts = require('./gulp/tasks/fonts');
const del = require('./gulp/tasks/clean');
const serve = require('./gulp/tasks/serve');

const dev = gulp.parallel(lesstocss, fonts, minifyImg, svgsprite, includetohtml);
const build = gulp.series(del, dev);
module.exports.start = gulp.series(build, serve);
module.exports.build = build;


Each task is separated into a separate file. For example, the imagemin.js task file:

const gulp = require('gulp');
const img = require('gulp-imagemin');

module.exports = function image() {
  return gulp.src('src/img/**')
    .pipe(img([
      img.mozjpeg({quality: 75, progressive: true}),
      img.svgo()
  ]))
      .pipe(gulp.dest('build/img'));
}


Error while running commands.
> gulp build
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module './gulp/tasks/imagemin'
Explain why it can't find my module files? What am I doing wrong?
Individually, each task starts and runs successfully.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-03-14
@mironov_m

Issue resolved. Unfortunately, my carelessness.
Paths are correct in gulpfile. The path was entered incorrectly in one of the tasks.
Question removed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question