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.
Restored from the Wayback Machine at the Internet Archive