Hatena::ブログ(Diary)

iDeaList::Writing このページをアンテナに追加 RSSフィード

2011-11-15

[][]EC2上のCentOSnode.jsのsocket.ioをインストールしようとした際のエラー

npmでsocket.ioがインストールできない!と思ったらデフォルトtar (GNU tar) 1.15.1だとダメだったというだけのメモ。


$ npm install socket.io
npm ERR! Failed unpacking /tmp/npm-1319403120027/1319403120088-0.7213427403476089/tmp.tgz
npm ERR! couldn't unpack /tmp/npm-1319403120027/1319403120088-0.7213427403476089/tmp.tgz to /tmp/npm-1319403120027/1319403120088-0.7213427403476089/contents
npm ERR! error installing socket.io-client@0.8.5 Error: `tar "-zmvxpf" "/tmp/npm-1319403120027/1319403120088-0.7213427403476089/tmp.tgz" "-o"`
npm ERR! error installing socket.io-client@0.8.5 failed with 2
npm ERR! error installing socket.io-client@0.8.5     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/tar.js:219:20)
npm ERR! error installing socket.io-client@0.8.5     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing socket.io-client@0.8.5     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! error installing socket.io@0.8.5 Error: `tar "-zmvxpf" "/tmp/npm-1319403120027/1319403120088-0.7213427403476089/tmp.tgz" "-o"`
npm ERR! error installing socket.io@0.8.5 failed with 2
npm ERR! error installing socket.io@0.8.5     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/tar.js:219:20)
npm ERR! error installing socket.io@0.8.5     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing socket.io@0.8.5     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! Error: `tar "-zmvxpf" "/tmp/npm-1319403120027/1319403120088-0.7213427403476089/tmp.tgz" "-o"`
npm ERR! failed with 2
npm ERR!     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/tar.js:219:20)
npm ERR!     at ChildProcess.emit (events.js:67:17)
npm ERR!     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>   
npm ERR!
npm ERR! System Linux 2.6.18-194.el5xen
npm ERR! command "node" "/usr/local/bin/npm" "install" "socket.io"
npm ERR! cwd /root/src/chat-node
npm ERR! node -v v0.4.12
npm ERR! npm -v 1.0.101
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /root/src/chat-node/npm-debug.log
npm not ok



まさにこのとおり。

What does tar --version output? If it's gnutar 1.15 or so, you need to upgrade to something more modern. I've been told by other CentOS users that 1.15.1 is the newest rpm available, so you may need to build from source.

https://github.com/isaacs/npm/issues/1559


デフォルトのバージョンは1.15.1

$ tar --version
tar (GNU tar) 1.15.1

最新の1.26をダウンロード&インストール

$ wget http://ftp.gnu.org/gnu/tar/tar-1.26.tar.gz
$ tar -xzvf tar-1.26.tar.gz
$ cd tar-1.26
$ ./configure FORCE_UNSAFE_CONFIGURE=1
$ make 
$ make install

できたできた

$ npm install socket.io
socket.io@0.8.5 ./node_modules/socket.io 
├── redis@0.6.6
├── policyfile@0.0.4
└── socket.io-client@0.8.5

[]Lionアップデート後にcpanmでエラー

自分用メモ。

This distribution requires a C compiler, but it's not available, stopped.

とか

/usr/bin/gcc-4.2 -c   -pipe -O2 -arch x86_64 -fno-common -DPERL_DARWIN -I/opt/local/include -no-cpp-precomp -fno-strict-aliasing -I/opt/local/include -O3   -DVERSION=\"2.22\" -DXS_VERSION=\"2.22\"  "-I/opt/local/lib/perl5/5.8.9/darwin-2level/CORE"   Stash.c
/bin/sh: /usr/bin/gcc-4.2: No such file or directory
make[1]: *** [Stash.o] Error 127
make: *** [subdirs] Error 2

ひたすらCのコンパイラがないよ!って怒られてビルドできなかったので、macportsgccを別途インストールしても動かなくて探してたら同じ現象の人がいた。

OSX 10.7 Lion にアップグレード後に壊れたPerl / cpanm 環境を復旧する - Goodpic


Xcode 4.2からGCC 4.2のサポートされなくなったようで、Lionアップグレードするとgccが消えてしまうらしい。

kennethreitz/osx-gcc-installer ? GitHubからOS X 10.7 Lion: GCC-10.7.pkgを探してダウンロード&インストール