Homebrewでnode(npm)をインストール⇒”yo ember”でエラーが発生した場合の対処法メモ


homebrewでnode(npm)をインストール(```brew install node```)して、```yo ember```したところ、以下のようなエラーが発生しまくった。
※```brew install node```すると、デフォルトではnpmも一緒にインストールされます。

```
$ yo
[?] Allo {私の名前}! What would you like to do? Install a generator
[?] Search NPM for generators: ember
[?] Here's what I found. Install one? generator-ember
npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
generator-mocha@0.1.5 /usr/local/lib/node_modules/generator-mocha
└── yeoman-generator@0.17.0 (dargs@0.1.0, debug@0.8.0, diff@1.0.8, class-extend@0.1.0, rimraf@2.2.8, text-table@0.2.0, mime@1.2.11, async@0.9.0, isbinaryfile@2.0.1, chalk@0.4.0, mkdirp@0.5.0, shelljs@0.3.0, nopt@2.2.1, underscore.string@2.3.3, iconv-lite@0.2.10, lodash@2.4.1, grouped-queue@0.2.1, glob@3.2.11, findup-sync@0.1.2, file-utils@0.2.0, request@2.40.0, cheerio@0.16.0, download@0.1.6, gruntfile-editor@0.1.0, inquirer@0.5.0)

generator-ember@0.8.4 /usr/local/lib/node_modules/generator-ember
├── fleck@0.5.1
└── yeoman-generator@0.16.0 (dargs@0.1.0, diff@1.0.8, debug@0.7.4, class-extend@0.1.1, rimraf@2.2.8, findup-sync@0.1.3, text-table@0.2.0, mime@1.2.11, async@0.2.10, mkdirp@0.3.5, isbinaryfile@2.0.1, shelljs@0.2.6, underscore.string@2.3.3, iconv-lite@0.2.11, lodash@2.4.1, chalk@0.4.0, glob@3.2.11, file-utils@0.1.5, cheerio@0.13.1, request@2.30.0, inquirer@0.4.1, download@0.1.19)


I just installed your generator by running:

    npm install -g generator-ember

[?] Allo {私の名前}! What would you like to do? Run the Ember generator (0.8.4)

Make sure you are in the directory you want to scaffold into.
This generator can also be run with: yo ember

:
略
:

npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /path/to/workspace/embertest
npm ERR! node -v v0.10.31
npm ERR! npm -v 2.0.0-beta.0
npm ERR! path /path/to/workspace/embertest/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/log-symbols/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js
npm ERR! fstream_path /path/to/workspace/embertest/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/log-symbols/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:287:26
npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR! Error: ENOENT, lstat '/path/to/workspace/embertest/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin/node_modules/bin-wrapper/node_modules/download/node_modules/decompress/node_modules/adm-zip/methods/deflater.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

:
```

どうやらhomebrewでインストールされたnpmがbeta版だったのがいけなかったようで、[https://github.com/npm/npm/issues/6047](https://github.com/npm/npm/issues/6047) を参考に```npm update -g npm```して```yo ember```し直したら、解消した。

```bash
$ npm -v
2.0.0-beta.0

$ npm update -g npm
npm WARN engine npm@1.4.25: wanted: {"node":">=0.8","npm":"1"} (current: {"node":"0.10.31","npm":"2.0.0-beta.0"})
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@1.4.25 /usr/local/lib/node_modules/npm

$ npm -v
1.4.25

$ yo ember
```