[Node.js] How to Install 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 .zshrc or .bashrc.
export PATH=$HOME/.nodebrew/current/bin:$PATH
Reload
% source ~/.bashrc
Check if installation was successful
% nodebrew help
Now just install Node.js.
% nodebrew stable
However, if you run into 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 “Checking for openssl : not found” appears even though openssl is installed can be resolved by installing pkg-config.
% brew install pkg-config
If you can’t install Node.js with an error like the following, it’s because Command Line Tools are not installed, so install them.
% nodebrew install v0.6.21
...(省略)...
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 we installed nodebrew, a Node.js version management tool, on Mac.