読者です 読者をやめる 読者になる 読者になる

compoundJSをinstallしようとしたらnpmが古くてハマった件

sudo npm install compound -g

とやるとエラー。。

$ sudo npm install compound -g
Password:
npm http GET https://registry.npmjs.org/compound
npm http 304 https://registry.npmjs.org/compound
npm http GET https://registry.npmjs.org/compound/-/compound-1.1.7-11.tgz
npm http 200 https://registry.npmjs.org/compound/-/compound-1.1.7-11.tgz
npm ERR! tar pack Error reading /Users/takayuki/tmp/npm-93579/1383704569828-0.4227180201560259/package
npm ERR! TypeError: Cannot call method 'filter' of undefined
npm ERR!     at Packer.IgnoreReader.addIgnoreRules (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:148:13)
npm ERR!     at Packer.IgnoreReader.addIgnoreFile (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:133:10)
npm ERR!     at fs.readFile (fs.js:176:14)
npm ERR!     at fs.close (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:94:5)
npm ERR!     at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 12.5.0
npm ERR! command "/Users/takayuki/.nvm/v0.8.4/bin/node" "/Users/takayuki/.nvm/v0.8.4/bin/npm" "install" "compound" "-g"
npm ERR! cwd /Users/takayuki
npm ERR! node -v v0.8.4
npm ERR! npm -v 1.1.45
npm ERR! type non_object_property_call
npm ERR! addLocalDirectory Could not pack "/Users/takayuki/tmp/npm-93579/1383704569828-0.4227180201560259/package" to "/Users/takayuki/.npm/compound/1.1.7-11/package.tgz"
npm ERR! SyntaxError: Unexpected token {
npm ERR!     at Object.parse (native)
npm ERR!     at Packer.readRules (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:188:33)
npm ERR!     at Packer.IgnoreReader.addIgnoreFile (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:132:22)
npm ERR!     at fs.readFile (fs.js:176:14)
npm ERR!     at fs.close (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:94:5)
npm ERR!     at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 12.5.0
npm ERR! command "/Users/takayuki/.nvm/v0.8.4/bin/node" "/Users/takayuki/.nvm/v0.8.4/bin/npm" "install" "compound" "-g"
npm ERR! cwd /Users/takayuki
npm ERR! node -v v0.8.4
npm ERR! npm -v 1.1.45
npm ERR! file /Users/takayuki/tmp/npm-93579/1383704569828-0.4227180201560259/package/templates/package.json
npm ERR! path /Users/takayuki/tmp/npm-93579/1383704569828-0.4227180201560259/package/templates
npm ERR! type unexpected_token
npm ERR! fstream_path /Users/takayuki/tmp/npm-93579/1383704569828-0.4227180201560259/package/templates
npm ERR! fstream_type Directory
npm ERR! fstream_class Packer
npm ERR! fstream_stack Packer.readRules (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:191:10)
npm ERR! fstream_stack Packer.IgnoreReader.addIgnoreFile (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:132:22)
npm ERR! fstream_stack fs.readFile (fs.js:176:14)
npm ERR! fstream_stack fs.close (/Users/takayuki/.nvm/v0.8.4/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:94:5)
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/takayuki/npm-debug.log
npm ERR! not ok code 0

ぎょええ。。「TypeError: Cannot call method 'filter' of undefined」を調べると、npmの最新では治ってるYO!とあったので、バージョンを確認。

npmとnodeのバージョンは下記。

$ npm -v
1.1.45

$node -v
v0.8.4

npmはnodeのバージョンに依存しているようなので、nodeのバージョンを上げてみる。 nvmが早速役に立つとは。

nvm ls-remote

をするとなんとv0.11.8まえある。。v0.10.6まで上げてみる。

nvm install v0.10.6

で再チャレンジしたところ・・通ったーーー!