Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialEnrique Gomez-Salas
19,437 PointsMy gulp clean task throwing me an error
Hi,
I have a problem when i run the gulp clean task.
treehouse-gulp-basics hugo$ gulp clean
module.js:557
throw err;
^
Error: Cannot find module 'gulp-sourcemaps'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/hugo/Desktop/treehouse-gulp-basics/gulpfile.js:8:12)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
This is what my js file looks like:
"use strict";
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
maps = require('gulp-sourcemaps'),
del = require('del');
gulp.task("concatScripts", function() {
return gulp.src([
'js/jquery.js',
'js/sticky/jquery.sticky.js',
'js/main.js'
])
.pipe(maps.init())
.pipe(concat('app.js'))
.pipe(maps.write('./'))
.pipe(gulp.dest('js'));
});
gulp.task("minifyScripts", ["concatScripts"], function() {
return gulp.src("js/app.js")
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(gulp.dest('js'));
});
gulp.task('compileSass', function() {
return gulp.src("scss/application.scss")
.pipe(maps.init())
.pipe(sass())
.pipe(maps.write('./'))
.pipe(gulp.dest('css'));
});
gulp.task('watchSass', function() {
gulp.watch('scss/**/*.scss', ['compileSass']);
});
gulp.task('clean', function() {
del("dist");
});
gulp.task("build", ['minifyScripts', 'compileSass'], function(){
return gulp.src(["css/application.css", "js/app.min.js", "index.html",
"img/**", "fonts/**"], { base: "./" })
.pipe(gulp.dest("dist"));
});
gulp.task("default", ["build"]);
Any ideas of what is wrong?