Ubuntu 13.10 の npm install で node-gyp rebuild が失敗する。

Ubuntu 13.10 で pm2 をインストールしようとした時、「gyp ERR! build error」というエラーが発生した。

$ npm install -g pm2
npm http GET https://registry.npmjs.org/pm2
npm http 200 https://registry.npmjs.org/pm2
npm http GET https://registry.npmjs.org/pm2/-/pm2-0.7.1.tgz
npm http 200 https://registry.npmjs.org/pm2/-/pm2-0.7.1.tgz
npm http GET https://registry.npmjs.org/pm2-interface/0.1.0
npm http GET https://registry.npmjs.org/pm2-multimeter/0.1.2
npm http GET https://registry.npmjs.org/usage/0.3.9
npm http GET https://registry.npmjs.org/axon-rpc/0.0.2
npm http GET https://registry.npmjs.org/watch/0.8.0
npm http GET https://registry.npmjs.org/axon/1.0.0
npm http GET https://registry.npmjs.org/cron/1.0.1
npm http GET https://registry.npmjs.org/colors/0.6.2
npm http GET https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/eventemitter2/0.4.13
npm http GET https://registry.npmjs.org/commander/2.1.0
npm http GET https://registry.npmjs.org/cli-table/0.2.0
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/async/0.2.9
npm http 200 https://registry.npmjs.org/pm2-multimeter/0.1.2
npm http 200 https://registry.npmjs.org/usage/0.3.9
npm http GET https://registry.npmjs.org/pm2-multimeter/-/pm2-multimeter-0.1.2.tgz
npm http GET https://registry.npmjs.org/usage/-/usage-0.3.9.tgz
npm http 200 https://registry.npmjs.org/axon/1.0.0
npm http GET https://registry.npmjs.org/axon/-/axon-1.0.0.tgz
npm http 200 https://registry.npmjs.org/pm2-interface/0.1.0
npm http GET https://registry.npmjs.org/pm2-interface/-/pm2-interface-0.1.0.tgz
npm http 200 https://registry.npmjs.org/colors/0.6.2
npm http 200 https://registry.npmjs.org/usage/-/usage-0.3.9.tgz
npm http GET https://registry.npmjs.org/colors/-/colors-0.6.2.tgz
npm http 200 https://registry.npmjs.org/eventemitter2/0.4.13
npm http GET https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.13.tgz
npm http 200 https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.3.tgz
npm http 200 https://registry.npmjs.org/cron/1.0.1
npm http 200 https://registry.npmjs.org/pm2-multimeter/-/pm2-multimeter-0.1.2.tgz
npm http GET https://registry.npmjs.org/cron/-/cron-1.0.1.tgz
npm http 200 https://registry.npmjs.org/commander/2.1.0
npm http GET https://registry.npmjs.org/commander/-/commander-2.1.0.tgz
npm http 200 https://registry.npmjs.org/cli-table/0.2.0
npm http GET https://registry.npmjs.org/cli-table/-/cli-table-0.2.0.tgz
npm http 200 https://registry.npmjs.org/pm2-interface/-/pm2-interface-0.1.0.tgz
npm http 200 https://registry.npmjs.org/debug
npm http 200 https://registry.npmjs.org/colors/-/colors-0.6.2.tgz
npm http 200 https://registry.npmjs.org/async/0.2.9
npm http GET https://registry.npmjs.org/async/-/async-0.2.9.tgz
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.3.tgz
npm http 200 https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.13.tgz
npm http 200 https://registry.npmjs.org/commander/-/commander-2.1.0.tgz
npm http 200 https://registry.npmjs.org/cli-table/-/cli-table-0.2.0.tgz
npm http 200 https://registry.npmjs.org/cron/-/cron-1.0.1.tgz
npm http 200 https://registry.npmjs.org/async/-/async-0.2.9.tgz
npm http 200 https://registry.npmjs.org/axon-rpc/0.0.2
npm http GET https://registry.npmjs.org/axon-rpc/-/axon-rpc-0.0.2.tgz
npm http 200 https://registry.npmjs.org/watch/0.8.0
npm http GET https://registry.npmjs.org/watch/-/watch-0.8.0.tgz
npm http 200 https://registry.npmjs.org/axon-rpc/-/axon-rpc-0.0.2.tgz
npm http 200 https://registry.npmjs.org/watch/-/watch-0.8.0.tgz
npm http 200 https://registry.npmjs.org/axon/-/axon-1.0.0.tgz
npm http GET https://registry.npmjs.org/commander/1.0.5
npm http GET https://registry.npmjs.org/charm
npm http GET https://registry.npmjs.org/colors/0.3.0
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/configurable/0.0.1
npm http GET https://registry.npmjs.org/escape-regexp/0.0.1
npm http 200 https://registry.npmjs.org/commander/1.0.5
npm http GET https://registry.npmjs.org/commander/-/commander-1.0.5.tgz
npm http 200 https://registry.npmjs.org/colors/0.3.0
npm http GET https://registry.npmjs.org/colors/-/colors-0.3.0.tgz
npm http 200 https://registry.npmjs.org/charm
npm http GET https://registry.npmjs.org/charm/-/charm-0.1.2.tgz
npm http 200 https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/bindings/-/bindings-1.1.1.tgz
npm http 200 https://registry.npmjs.org/commander/-/commander-1.0.5.tgz
npm http 200 https://registry.npmjs.org/colors/-/colors-0.3.0.tgz
npm http 200 https://registry.npmjs.org/charm/-/charm-0.1.2.tgz
npm http GET https://registry.npmjs.org/keypress
npm http 200 https://registry.npmjs.org/bindings/-/bindings-1.1.1.tgz

> usage@0.3.9 install /home/azureuser/.nvm/v0.10.24/lib/node_modules/pm2/node_modules/usage
> node-gyp rebuild

gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at F (/home/azureuser/.nvm/v0.10.24/lib/node_modules/npm/node_modules/which/which.js:43:28)
gyp ERR! stack     at E (/home/azureuser/.nvm/v0.10.24/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! stack     at /home/azureuser/.nvm/v0.10.24/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! stack     at Object.oncomplete (fs.js:107:15)
gyp ERR! System Linux 3.11.0-14-generic
gyp ERR! command "node" "/home/azureuser/.nvm/v0.10.24/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/azureuser/.nvm/v0.10.24/lib/node_modules/pm2/node_modules/usage
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok 
npm http 200 https://registry.npmjs.org/configurable/0.0.1
npm http GET https://registry.npmjs.org/configurable/-/configurable-0.0.1.tgz
npm http 200 https://registry.npmjs.org/escape-regexp/0.0.1
npm http GET https://registry.npmjs.org/escape-regexp/-/escape-regexp-0.0.1.tgz
npm http 200 https://registry.npmjs.org/keypress
npm http 200 https://registry.npmjs.org/configurable/-/configurable-0.0.1.tgz
npm http 200 https://registry.npmjs.org/escape-regexp/-/escape-regexp-0.0.1.tgz
npm ERR! usage@0.3.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the usage@0.3.9 install script.
npm ERR! This is most likely a problem with the usage package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls usage
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-14-generic
npm ERR! command "/home/azureuser/.nvm/v0.10.24/bin/node" "/home/azureuser/.nvm/v0.10.24/bin/npm" "install" "-g" "pm2"
npm ERR! cwd /home/azureuser/fy11
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/azureuser/fy11/npm-debug.log
npm ERR! not ok code 0

build-essential が入っていないと、 node-gyp が動かず、npm install が失敗するようだ。

$ sudo apt-get install build-essential
$ npm install -g pm2

参考:http://stackoverflow.com/questions/14772508/npm-failed-to-install-time-with-make-not-found-error

Node.jsUbuntunpm