-
-
Save kugaevsky/68a7fa894551da9c310a to your computer and use it in GitHub Desktop.
$ cd /usr/local | |
$ git checkout b64d9b9c431642a7dd8d85c8de5a530f2c79d924 Library/Formula/node.rb | |
$ brew unlink node | |
$ brew install node | |
$ npm install -g npm@latest |
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.
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.
I ran into the same need and ended up trying nvm
(Node Version Manager) instead. Fingers crossed.
@flipjs git checkout path-to/Library/Formula/node.rb
should resolve your issue.
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
@kugaevsky, this helped me. Thank you!
@kugaevsky I get this error when I run the 2nd git command:
``fatal: reference is not a tree: b64d9b9c431642a7dd8d85c8de5a530f2c79d924`
You save me~
@hchouhan, solution from @lloydde is working in this case.
thank you