Setting up CI for a node.js project, I discovered one of life’s little ironies. Node.js bills itself as a programming framework with a “non-blocking I/O model”, but npm — the node.js package manager — which installs libraries needed by a node app relies on a single cache file structure (typically ~/.npm) which can cause problems if you try to run ‘npm install -d’ more than one at a time.
Technically this isn’t an issue with parallelism in node.js — since it’s the package manager, not the execution environment, but it does cause one to question how well thought out the architecture of node.js is.
We’ve all heard stories about how LinkedIn and others have used node.js to parallelize their web services, etc. But if you care to listen you hear even more stories about pitfalls people run into using node.js.
I’m not bashing node.js, but it’s a good idea to remember that node.js is a young, relatively untried product with a lot of lessons to learned and a lot of people who don’t know basic principals jumping on the band wagon because it is new and sounds cool, thinking it’s a pancea for everything.
Reminds me of Ruby on Rails.
I found a workaround to this–
before you run `npm install -d` set $HOME to a unique path.