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

Tony Brackins
Tony Brackins
28,766 Points

After running server, I don't see app.js

After running gulp concatScripts and running the server, I don't see app.js when I view the source of the web page, however, in the directory, I do see app.js.

Here's my gulp.js:

'use strict'; //causes nodefile to go strict
var gulp = require('gulp'),
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("default", ["hello"], function(){
console.log("This is the default task!");
});

Hi Tony B, just letting you know I wrapped your code in a code block with syntax highlighting.

7 Answers

Don't forget to update index.html to only load js/app.js and not the three individual files.

Oh and you'll need to stop and restart the http-server to see the changes, and potentially clear your browser's cache and refresh the page.

Tony Brackins
Tony Brackins
28,766 Points

gulp concatScripts. It actually worked, but is not reflecting when I launch the server.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Just catching up on this course and it is the same for me. I don't get an app.js but i can see that the jquery is working and I know an app.js file exists.

Is anyone ever going to answer this ?

George Matthews
George Matthews
8,029 Points

I know this has been a long time since this was opened but i'm doing this course and I don't see the app.js file in my folders either. When I run the server on 3000 it works and I inspect and see the app.js is there but in the folder on my computer there is no app.js.

Any ideas?

steven alston
steven alston
16,292 Points

One of the first things he did was to delete the 3 js files and add just the app.js to the footer of the index.html file.

steven alston
steven alston
16,292 Points

I know this is a little older of a post, but the first thing he did was to delete the 3 js files and add just the app.js to the footer of the index.html file.

Jose Figueroa
Jose Figueroa
16,781 Points

This is the code that worked for me. Hope it helps.

"use strict";

let gulp = require("gulp");
let concat = require('gulp-concat');

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

gulp.task("default", gulp.parallel("concatScripts"), function() {
  console.log("This is the default task!");
});

It looks as if your 'default' task isn't calling your 'concatScripts' task.

I think your default task should look like the following:

gulp.task('default', ['concatScripts'], function() {
  console.log('This is the default task!');
});
Tony Brackins
Tony Brackins
28,766 Points

In the video, the default task is as above. :/

How are you calling the task from the command line?

Are you just typing gulp ?

If so, then that will just run the default task.

You can either specify a task after the gulp command, or set it as a dependency in the default gulp task

> gulp // runs default task
> gulp concatScripts // runs concatScripts