nodebrewのセットアップにハマった案件。
nodebrewでnodeのインストールができない
$ nodebrew install-binary v6.10.0
Fetching: https://nodejs.org/dist/v6.10.0/node-v6.10.0-darwin-x64.tar.gz
Warning: Failed to create the file
Warning: /Users/hikaru/.nodebrew/src/v6.10.0/node-v6.10.0-darwin-x64.tar.gz:
Warning: No such file or directory
0.0%
curl: (23) Failed writing body (0 != 847)
download failed: https://nodejs.org/dist/v6.10.0/node-v6.10.0-darwin-x64.tar.gz
はて・・・~/.nodebrew
ディレクトリが無いだと・・。
解決
Homebrewでインストールした時に
$ brew install nodebrew
:(省略)
==> Caveats
You need to manually run setup_dirs to create directories required by nodebrew:
/usr/local/opt/nodebrew/bin/nodebrew setup_dirs
Add path:
export PATH=$HOME/.nodebrew/current/bin:$PATH
To use Homebrew's directories rather than ~/.nodebrew add to your profile:
export NODEBREW_ROOT=/usr/local/var/nodebrew
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions have been installed to:
/usr/local/share/zsh/site-functions
:(省略)
セットアップの方法がちゃんと書いてあるではないか!!
$ /usr/local/opt/nodebrew/bin/nodebrew setup_dirs
$ echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile
これで無事にnodeを入れることができた。
$ nodebrew install-binary v6.10.0
Fetching: https://nodejs.org/dist/v6.10.0/node-v6.10.0-darwin-x64.tar.gz
######################################################################## 100.0%
Installed successfully
$ nodebrew use v6.10.0
use v6.10.0
$ node -v
v6.10.0