nodebrewを新規で入れた時の問題?

Macにおいて表題の件。

■ 環境

  • nodebrew
  • Homebrew
  • Mac OSX El Capitan

■ nodebrew

新規Macでの環境構築中、`nodebrew`を使いたくてインストールしたのだが実際に`node`をインストールする時点で躓いてしまった。

まずは`nodebrew`をインストール。

$ brew install nodebrew
  :
==> Caveats
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 completion has been installed to:
  /usr/local/share/zsh/site-functions
$

今回は`NODEBREW_ROOT`を設定してホームディレクトリ配下ではなく`/usr/local`配下に配置しようと`.bashrc`に下記のように設定した。

$ cat .bashrc
  :
# nodebrew
export NODEBREW_ROOT=/usr/local/var/nodebrew
export PATH=${NODEBREW_ROOT}/current/bin:$PATH
$

実際に`node`をインストールしようとしたところ下記のように。ちなみにversionはLTSである”v4.4.7“にした。

$ nodebrew install v4.4.7
Fetching: https://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz
Warning: Failed to create the file
Warning: /usr/local/var/nodebrew/src/v4.4.7/node-v4.4.7.tar.gz: No such file
Warning: or directory

curl: (23) Failed writing body (0 != 666)
download failed: https://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz
$

ディレクトリを先に作成しなければならないようだ。

$ mkdir /usr/local/var/nodebrew

このディレクトリを作成後に再度実行したものの同じエラーが発生。さらにもう一段階ディレクトリを作成。最終的には下記を実行すれば問題なさそうであった。

$ mkdir -p /usr/local/var/nodebrew/src

と思っていたら…以前にも同じようにはまっていたようである。

nodebrewで初回使用時にエラー

以上。

■ 関連