Skip to content

Instantly share code, notes, and snippets.

@kugaevsky
Last active July 4, 2018 09:06
Show Gist options
  • Save kugaevsky/68a7fa894551da9c310a to your computer and use it in GitHub Desktop.
Save kugaevsky/68a7fa894551da9c310a to your computer and use it in GitHub Desktop.
Reverting back to node 0.10.36 on Mac OS X with Homebrew
$ cd /usr/local
$ git checkout b64d9b9c431642a7dd8d85c8de5a530f2c79d924 Library/Formula/node.rb
$ brew unlink node
$ brew install node
$ npm install -g npm@latest
@stefanjauker
Copy link

Thanks!

@msuarz
Copy link

msuarz commented May 22, 2015

thank you

@jhohlfeld
Copy link

Awesome! I could also keep a newer and an older version of node at the same time!

Just do the same as above:

$ cd /usr/local
$ git checkout b64d9b9c431642a7dd8d85c8de5a530f2c79d924 Library/Formula/node.rb
$ brew unlink node
$ brew install node
$ npm install -g npm@latest

Then use brew switch:

$ brew switch node 0.12.2_1
Cleaning /usr/local/Cellar/node/0.10.36
Cleaning /usr/local/Cellar/node/0.12.2_1
6 links created for /usr/local/Cellar/node/0.12.2_1
$ node -v
v0.12.2

and switch back again!

$ brew switch node 0.10.36
Cleaning /usr/local/Cellar/node/0.10.36
Cleaning /usr/local/Cellar/node/0.12.2_1
5 links created for /usr/local/Cellar/node/0.10.36
$ node -v
v0.10.36

Very powerful indeed.

@flipjs
Copy link

flipjs commented Jun 18, 2015

This worked for me. My node version is back to 0.10.xx

But when I 'brew update', I get this error:

error: Your local changes to the following files would be overwritten by merge:
    Library/Formula/node.rb
Please, commit your changes or stash them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

Anyone know how to fix this? Thanks.

@levicook
Copy link

I ran into the same need and ended up trying nvm (Node Version Manager) instead. Fingers crossed.

@dwlf
Copy link

dwlf commented Aug 12, 2015

@flipjs git checkout path-to/Library/Formula/node.rb should resolve your issue.

@dwlf
Copy link

dwlf commented Aug 12, 2015

Another solution to revert back to the latest node 0.10:

brew unlink node
brew install https://raw.githubusercontent.com/Homebrew/homebrew-versions/master/node010.rb
npm install -g npm@latest

@jeremyckahn
Copy link

@kugaevsky, this helped me. Thank you!

@hchouhan
Copy link

hchouhan commented Nov 7, 2015

@kugaevsky I get this error when I run the 2nd git command:
``fatal: reference is not a tree: b64d9b9c431642a7dd8d85c8de5a530f2c79d924`

@pandaforme
Copy link

You save me~

@oliamb
Copy link

oliamb commented Jan 5, 2016

@hchouhan, solution from @lloydde is working in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment