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 trial

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