Node Package Manager – Installing Packages Per Project

Just a quick note. I’m using Ubuntu on my development machine. I have been using the less css ( lessc ) package provided via npm ( node package manager ) and installed in my local user ( you know ~/ or perhaps /home/USER ) directory but wanted to install it on a per project basis. Initially when I tried the npm install for less in the project I was rather confused as the package manager is supposed to install to the current working directory yet it kept installing to the currently installed location which was not within my project but within my user directory. That was not what I wanted.

Eventually I discovered the little gem that if there is no node_modules directory in your current directory it will search recursively looking for said directory. The solution was to simply create a node_modules directory within my project and run the npm install command from it’s parent directory. A bit awkward but I like it. It would be nice if this was better documented but I certainly see the reasoning for such behavior.

Anyhow, it’s smart to keep your npm packages local to the project in most instances so you don’t get the random WTF when you update for your current project and an older project decides to crap the bed. Like I said, quick note. I hope it helps you, if anything my writing about it will keep the thought well branded on my brain.

Cheers!

This entry was posted in Uncategorized. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Tweet, tweet...

    • At Bocoup Loft for some jquery meetup goodness. 2010-04-07
    • Digging deeper into Media Tags and wordpress... considering quite a few new features for the next version of Tag Gallery... collages anyone? 2010-04-06
    • Fine tuning nginx for http://johnnypeck.com - having a few issues with some optimizations but overall, performance is incredible. 2010-03-31
    • More updates...
  • Donations

    Donate to the development of Tag Gallery! It let's me spend more time on it. Thanks!