Skip to content

Instantly share code, notes, and snippets.

@uupaa
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save uupaa/61ee8e70216bb789f7b0 to your computer and use it in GitHub Desktop.

Select an option

Save uupaa/61ee8e70216bb789f7b0 to your computer and use it in GitHub Desktop.
WebModule install process (brew + io.js 環境構築)

homebrew を使い、 node, npm と iojs の最新をインストールし、利用できるようにしてみましょう。

$ brew install node             // 一緒に npm もインストールされます

$ node --version
> v0.12.2

$ npm --version
> 2.10.0

$ brew install iojs             // iojs 2.0.2 がインストールされました

$ iojs --version 
> zsh: command not found: iojs

// ??? エラーになってしまいます
// 実はこのままでは iojs コマンドは利用できません
// brew link --force を使い node の代わりに iojs を link する必要があります。
// その前に brew unlink node で node の link を先に外しましょぅ

$ brew unlink node
> Unlinking /usr/local/Cellar/node/0.12.2_1... 7 symlinks removed

$ brew link --force iojs
> Linking /usr/local/Cellar/iojs/2.0.2... 6 symlinks created

$ node --version
> v2.0.2                        // node コマンドの代わりに iojs にリンクが張られました

$ npm --version
> 2.10.0                        // npm コマンドも利用できます

以上の操作を行うと、iojs が利用可能になります。
元に戻し node.js を使いたい場合は、以下のコマンドを実行してください。

$ brew unlink iojs
$ brew link node
$ node --version
> v0.12.0

$ npm --version
> 2.10.0

iojs をアンインストールする場合は、以下のコマンドを実行してください。

$ brew unlink iojs
$ brew link node
$ brew uninstall iojs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment