Error: Cannot find module 'gulp.spritesmith'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (D:\Образ локал\OSPanel\domains\untitled1\gulpfile.js:5:21)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
не может найти модуль а как его найти
вот файл gulp gs
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const pug = require('gulp-pug');
const sass = require('gulp-sass');
const spritesmith = require('gulp.spritesmith');
const rimraf = require('rimraf');
const rename = require('gulp-rename');
/* -------- Server -------- */
gulp.task('server', function() {
browserSync.init({
server: {
port: 9000,
baseDir: "build"
}
});
gulp.watch('build/**/*').on('change', browserSync.reload);
});
/* ------------ Pug compile ------------- */
gulp.task('templates:compile', function buildHTML() {
return gulp.src('source/template/index.pug')
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest('build'))
});
/* ------------ Styles compile ------------- */
gulp.task('styles:compile', function () {
return gulp.src('source/styles/main.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(rename('main.min.css'))
.pipe(gulp.dest('build/css'));
});
/* ------------ Sprite ------------- */
gulp.task('sprite', function(cb) {
const spriteData = gulp.src('source/images/icons/*.png').pipe(spritesmith({
imgName: 'sprite.png',
imgPath: '../images/sprite.png',
cssName: 'sprite.scss'
}));
spriteData.img.pipe(gulp.dest('build/images/'));
spriteData.css.pipe(gulp.dest('source/styles/global/'));
cb();
});
/* ------------ Delete ------------- */
gulp.task('clean', function del(cb) {
return rimraf('build', cb);
});
/* ------------ Copy fonts ------------- */
gulp.task('copy:fonts', function() {
return gulp.src('./source/fonts/**/*.*')
.pipe(gulp.dest('build/fonts'));
});
/* ------------ Copy images ------------- */
gulp.task('copy:images', function() {
return gulp.src('./source/images/**/*.*')
.pipe(gulp.dest('build/images'));
});
/* ------------ Copy ------------- */
gulp.task('copy', gulp.parallel('copy:fonts', 'copy:images'));
/* ------------ Watchers ------------- */
gulp.task('watch', function() {
gulp.watch('source/template/**/*.pug', gulp.series('templates:compile'));
gulp.watch('source/styles/**/*.scss', gulp.series('styles:compile'));
});
gulp.task('default', gulp.series(
'clean',
gulp.parallel('templates:compile', 'styles:compile', 'sprite', 'copy'),
gulp.parallel('watch', 'server')
)
);