Generally programmer wisdom is to “stay current” with the latest versions of working software. However, this is not always feasible.
today I spent some time today discovering that that ember-cli, Node, and NPM are, shall we say, under active development (to put it politely) so much so that an app created a short time ago is already three or more point versions behind each of ember-cli, Node, and NPM. Upgrading these out of step does not play nicely – not nearly as nice as compared to the world of Rails gems.
Since the exact version problems are specific to our app I am leaving them out of this post, but suffice it to say today I needed to install version 0.10.26 node and npm 1.4.3 for use with an old version of ember-cli. (The current versions as of this writing are 0.10.29 and 1.4.16, respectively.)
Node Old Version Install
Normally, to install node you use brew install node. This installs latest version.
To use brew to install an old version you have to jerry rig brew, described on this stackoverflow post. (I realize you could also install node from source, which might be an easier option depending on your preference. For sake of this post, I am explaining how to do it with brew.)
Navigate to your homebrew base directory (usually this is /usr/local)
Enter brew versions <formula> (is the formula you want to install).
You will then get something like:
0.10.29 git checkout 7b968c6 Library/Formula/node.rb
0.10.28 git checkout f7d75de Library/Formula/node.rb
0.10.26 git checkout 0901e77 Library/Formula/node.rb
0.10.25 git checkout bae051d Library/Formula/node.rb
0.10.24 git checkout 8c47ff7 Library/Formula/node.rb
0.10.23 git checkout 5ab4328 Library/Formula/node.rb
In my case I wanted Node 0.10.26
git checkout 0901e77 Library/Formula/node.rb
Step 3.5 (maybe necessary)
Do this if you already have another version installed.
Once installed, verify node version with node -v.
NPM Old Version Install
Then, you’ll want to tell NPM to use an old version like so:
(I realize this is npm telling itself to install a different version of itself, but this seems to be the only way to do it.)
That’s all you’ll have to do, NPM will just be in that version from now on until you update it.
2 thoughts on “How to Install Old Versions of Node and NPM”
Hi jasonfleetwoodboldt.com owner, Your posts are always well-balanced and objective.
To the jasonfleetwoodboldt.com webmaster, You always provide valuable information.