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

jbiscornet
jbiscornet
22,547 Points

using third party gulp libraries - cannot find module 'gulp-concat'

I am a little confused and don't know where to start. I just downloaded sublime text 3 and have been trying to get a handle on how that operates also so that might be a part of it also. As I follow along with the video and we concatonate a few js files into 1 app.js file and use a gulp-concat module to run that, when I go to run it in the console I get this error:

MacBook-Pro:treehouse-gulp-basics Kat$ gulp concatScripts module.js:529 throw err; ^

Error: Cannot find module 'gulp-concat' at Function.Module._resolveFilename (module.js:527:15) at Function.Module._load (module.js:476:23) at Module.require (module.js:568:17) at require (internal/module.js:11:18) at Object.<anonymous> (/Users/Kat/treehouse-gulp-basics/gulpfile.js:4:10) at Module._compile (module.js:624:30) at Object.Module._extensions..js (module.js:635:10) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12)

I notice that the files I have been writing in sublime text (that I pulled up from the terminal after I figured out how to set the path in the console to sublime text) has the heading "gulpfile.js--treehouse-gulp-basics" and all the downloaded files I got from git are "--Downloads/treehouse-gulp-basics-master" so I am thinking that they are not connected to my current directory on the console where I am giving the demands, and if I try to change the directory to that downloads directory it says no such file or directory found.

I just got into the sublime text app and I haven't had a lot of experience with that or the console or gulp or git, so it's a lot to jump into at once and I'm not sure where to start, this course never really explains how to deal with the project files and how to incorporate them into the text editor, I had to figure that out, so it could be that I didn't do that right in the first place. The project files are all in the github project site:

https://github.com/hdngr/treehouse-gulp-basics

If anyone has any insight or can point me in the right direction as to what is going wrong, I would really appreciate it.

Thanks, J

2 Answers

Charles Wanjohi
Charles Wanjohi
9,235 Points

You just need to install the module by running npm install --save-dev gulp-concat to have the module available for your project

jbiscornet
jbiscornet
22,547 Points

Thanks charles that worked for me. I still don't understand the tie in to the rest of the downloaded project files and why they have different headings. Does that even matter? Do you just drag and drop them into the text editor after you download the zip file or is there a better way I should have done it?

Charles Wanjohi
Charles Wanjohi
9,235 Points

The different in headings indicate the so far made progress ....same project but some with more code depending on the stage you are at

Vitaly Khe
Vitaly Khe
7,160 Points

had the same issue on windows.

  1. delete package-lock.json from your project folder
  2. npm install