[Node.js] How to Install the Version Management Tool nodebrew on Mac
I’ll introduce how to install nodebrew, a Node.js version management tool, on Mac.
% curl https://raw.github.com/hokaccha/nodebrew/master/nodebrew | perl - setup
Add the following to your .zshrc or .bashrc:
export PATH=$HOME/.nodebrew/current/bin:$PATH
Reload:
% source ~/.bashrc
Check if it was installed correctly:
% nodebrew help
Now just install Node.js:
% nodebrew stable
However, if you encounter various issues, please refer to the following content.
% nodebrew install v0.6.21
fetch: http://nodejs.org/dist/v0.6.21/node-v0.6.21.tar.gz
######################################################################## 100.0%
Checking for program g++ or c++ : not found
/Users/your_username/.nodebrew/src/node-v0.6.21/wscript:273: error: could not configure a cxx compiler!
Install gcc: ・kennethreitz/osx-gcc-installer · GitHub
The problem where openssl is installed but shows “Checking for openssl : not found” can be solved by installing pkg-config.
% brew install pkg-config
If you can’t install Node.js with an error like the one below, it’s because Command Line Tools isn’t installed, so install it.
% nodebrew install v0.6.21
...(omitted)...
make[1]: *** [src/unix/darwin.o] Error 1
Waf: Leaving directory `/Users/your_username/.nodebrew/src/node-v0.6.21/out'
Build failed: -> task failed (err #2):
{task: uv uv.h -> uv.a}
make: *** [program] Error 1
Command Line Tools can be installed from:
Xcode -> Preferences -> Downloads -> Command Line Tools
That’s all from the Gemba where I installed nodebrew, the Node.js version management tool, on Mac.