How to install multiple versions of the same node.js module?
node.js, npm
Solution
I don't think there is a (good) way to do this.
However, I'm guessing that your use case is this: You have two projects, which require different versions of a globally installed package.
For cases like this, I usually avoid installing packages globally altogether, and install them locally instead (without `-g`). For example, if you wanted to install a specific older version of the "mocha" package for a given project, you'd do
cd ~/src/myproject
npm install --save-dev mocha@^1.0.0
(Note that we're not using `-g` here.) Then call it like so:
./node_modules/.bin/mocha
Problem
Can I install multiple versions of the same `node` module globally with `npm`?