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 trialBrendan Whiting
Front End Web Development Techdegree Graduate 84,738 Pointsnpm install on my machine is defaulting to global
I'm trying to practice some of what I learned in Gulp on my local machine, but when I try and do npm install [module]
it defaults to global without me adding the -g flag. It doesn't add a node_modules folder in my local directory.
Maybe I changed some preferences at some point? Trying to read the docs but I can't make sense of it.
2 Answers
Rich Donnellan
Treehouse Moderator 27,696 PointsAdd the --save
flag. Read more at the npm docs.
npm install [module] --save
Craig Watson
27,930 PointsHi Brendan,
Sorry I could not reply sooner, but glad to hear you have it sorted...
Craig
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsI don't know why I'm struggling so much with this. Here is what I did in my terminal:
npm install underscore --save
node_modules
folder, not localnode_modules
foldernpm ls
shows all the global modules includingunderscore
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsBrendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsI think I solved it - I hadn't done
npm init
Rich Donnellan
Treehouse Moderator 27,696 PointsRich Donnellan
Treehouse Moderator 27,696 PointsNice! Chances are you won't make the same mistake again! :)