Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Gulp Basics Gulp your JavaScript Workflow Using Third Party Gulp Libraries

Unable to concatenate JS

when I use Script in terminal gulp concatScript. It's giving me error : asserts.js:350

'use strict'; var gulp = require('gulp'), concat = require('gulp-concat');

gulp.task("concatScripts", function(){
    gulp.src([
        'js/main.js', 
        'js/ScriptProcessorNode.js'])
        .pipe(concat("app.js"))
        .pipe(gulp.dest("js"));
});

gulp.task("default", ["hellp"], function(){ console.log("the default task!!"); });

Hello,

This Treehouse course is significantly out of date, however I did some research to find some code that works. So I will share with you!

'use strict';

const gulp = require('gulp');
const concat = require('gulp-concat');

gulp.task("concatScripts", function () {
    gulp.src([
    'js/jquery.js',
    'js/sticky/jquery.sticky.js',
    'js/main.js' ])
    .pipe(concat("app.js"))
    .pipe(gulp.dest("js"));
});

gulp.task("hello", function () {
    console.log("Hello!");
});

gulp.task('default', gulp.parallel('hello', function(done){
    console.log('This is the dafault task!');
    done();
}));

Let me know if it helps.

Also on a side note you may find the Http server is not working, that is because there is currently a bug. So install npm:

npm install -g http-server@0.9.0

1 Answer

Gavin Ross
Gavin Ross
4,401 Points

Don't fully know what the issue is but if you open up the terminal and cd into the ./node_modules and enter sudo rm -r .gulp.concat.DELETE then run the npm install gulp-concat --save-dev again. That should make it work like it's supposed to