При попытке запустить Gulp выдается ошибка:
Error: No valid exports main found for 'E:\My Lessons\Bootstrap\Уроки\IT Doctor\Work\node_modules\colorette'
at resolveExportsTarget (internal/modules/cjs/loader.js:618:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:650:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:948:27)
at Function.Module._load (internal/modules/cjs/loader.js:854:27)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (E:\My Lessons\Bootstrap\Уроки\IT Doctor\Work\node_modules\autoprefixer\lib\autoprefixer.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:1128:30) {
code: 'MODULE_NOT_FOUND'
}
Файл package.json :
{
"name": "bootstrap",
"version": "1.0.0",
"description": "Сайт на сетке Bootstrap 4",
"main": "gulpfile.js",
"scripts": {
"test": "gulp"
},
"repository": {
"type": "git",
"url": "git+https://github.com/youngFrontendDeveloper/website-on-Bootstrap4.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/youngFrontendDeveloper/website-on-Bootstrap4/issues"
},
"homepage": "https://github.com/youngFrontendDeveloper/website-on-Bootstrap4#readme",
"devDependencies": {
"autoprefixer": "^10.2.3",
"browser-sync": "^2.26.13",
"del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-csso": "^4.0.1",
"gulp-imagemin": "^7.1.0",
"gulp-less": "^4.0.1",
"gulp-plumber": "^1.2.1",
"gulp-postcss": "^9.0.0",
"gulp-posthtml": "^3.0.5",
"gulp-rename": "^2.0.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-svgstore": "^7.0.1",
"gulp-uglify": "^3.0.2",
"gulp-webp": "^4.0.1",
"posthtml-include": "^1.6.0"
}
}
файл gulpfile.js :
// "use strict";
var gulp = require("gulp");
var less = require("gulp-less");
var plumber = require("gulp-plumber");
var sourcemap = require("gulp-sourcemaps");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var postcss = require("gulp-postcss");
var autoprefixer = require("autoprefixer");
var csso = require("gulp-csso");
var rename = require("gulp-rename");
var imagemin = require("gulp-imagemin");
var webp = require("gulp-webp");
var svgstore = require("gulp-svgstore");
var posthtml = require("gulp-posthtml");
var include = require("posthtml-include");
var del = require("del");
var server = require("browser-sync").create();
gulp.task("clean", function () {
return del("build");
});
gulp.task("copy", function () {
return gulp.src([
"source/fonts/**/*.{woff,woff2}",
"source/img/**",
"source/js/libs/*.js",
"source/*.ico",
"source/video/*.*"
], {
base: "source"
})
.pipe(gulp.dest("build"));
});
gulp.task("css", function () {
return gulp.src("source/less/style.less")
.pipe(plumber())
.pipe(sourcemap.init())
.pipe(less())
.pipe(postcss([
autoprefixer()
]))
.pipe(gulp.dest("build/css"))
.pipe(csso())
.pipe(rename("style.min.css"))
.pipe(sourcemap.write("."))
.pipe(gulp.dest("build/css"))
.pipe(server.stream());
});
gulp.task("sprite", function () {
return gulp.src("source/img/*.svg")
.pipe(svgstore({
inlineSvg: true
}))
.pipe(rename("sprite.svg"))
.pipe(gulp.dest("build/img"));
});
gulp.task("html", function () {
return gulp.src("source/*.html")
.pipe(posthtml([
include()
]))
.pipe(gulp.dest("build"));
});
gulp.task("images", function () {
return gulp.src("source/img/**/*.{png,jpg,svg}")
.pipe(imagemin([
imagemin.optipng({
optimizationLevel: 3
}),
imagemin.jpegtran({
progressive: true
}),
imagemin.svgo()
]))
.pipe(gulp.dest("source/img"));
});
gulp.task("webp", function () {
return gulp.src("source/img/**/*.{png,jpg}")
.pipe(webp({
quality: 90
}))
.pipe(gulp.dest("source/img"));
});
// Файлы для подключения в строгом порядке:
let jsFiles = [
"./source/js/main.js"
];
// Task на скрипты JS
gulp.task("script", function () {
return gulp.src(jsFiles)
.pipe(sourcemap.init()) // инициализируем создание Source Maps
.pipe(concat("script.js")) // Объединение файлов в один
.pipe(gulp.dest("./source/js"))
.pipe(uglify({
toplevel: true
}))
.pipe(sourcemap.write(".")) // пути для записи SourceMaps - в данном случае карта SourceMaps будет добавлена прям в данный файл scripts.min.js в самом конце в формате комментария
.pipe(gulp.dest("./build/js"))
.pipe(server.stream());
});
gulp.task("server", function () {
server.init({
server: "build/",
notify: false,
open: true,
cors: true,
ui: false
});
gulp.watch("source/less/**/*.less", gulp.series("css"));
gulp.watch("source/js/**/*.js", gulp.series("script"));
gulp.watch("source/img/icon-*.svg", gulp.series("sprite", "html", "refresh"));
gulp.watch("source/*.html", gulp.series("html", "refresh"));
});
gulp.task("refresh", function (done) {
server.reload();
done();
});
gulp.task("build", gulp.series("clean", "copy", "css", "script", "images", "webp", "sprite", "html"));
gulp.task("default", gulp.series("build", "server"));
В node_modules сама папка colorette есть .