Answer the question
In order to leave comments, you need to log in
Why does an error appear when loading a task?
Hello!
I finally got to gulp. I'll start over:
1) I installed all sorts of things like compiling sass, browsersync and all that
2) It came to connecting concat and uglifyjs: I
installed everything as it should be through the console. Installed:
3) I connect:
var gulp = require('gulp'), // Gulp
sass = require('gulp-sass'), // Sass пакет,
browserSync = require('browser-sync'), // Browser Sync
autoprefixer = require('gulp-autoprefixer'),// автопрефиксер
concat = require('gulp-concat'),// gulp-concat (для конкатенации файлов)
uglify = require('gulp-uglifyjs'); // gulp-uglifyjs (для сжатия JS)
gulp.task('scripts', function() {
return gulp.src([ // Беру все необходимые библиотеки
'app/libs/jquery/dist/jquery.min.js' // Беру jQuery
])
.pipe(concat('libs.min.js')) // Собираю их в кучу в новом файле libs.min.js
.pipe(uglify()) // Сжимаю JS файл
.pipe(gulp.dest('app/js')); // Выгружаею в папку app/js
});
gulp scripts
W:\!Mary\myproject>gulp scripts
module.js:471
throw err;
^
Error: Cannot find module 'gulp-concat'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (W:\!Mary\myproject\gulpfile.js:9:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
W:\!Mary\myproject>
uglify = require('gulp-uglifyjs'), // gulp-uglifyjs (для сжатия JS)
concat = require('gulp-concat');// gulp-concat (для конкатенации файлов)
W:\!Mary\myproject>gulp scripts
module.js:471
throw err;
^
Error: Cannot find module 'gulp-uglifyjs'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (W:\!Mary\myproject\gulpfile.js:9:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
W:\!Mary\myproject>
Answer the question
In order to leave comments, you need to log in
var concat = require(' concat '); // not gulp-concat
var uglify = require(' uglifyjs '); // not gulp-uglifyjs
Look again closely at devDependencies
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question