2011-11-15
■[CentOS][node.js]EC2上のCentOSにnode.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.
デフォルトのバージョンは1.15.1
$ tar --version tar (GNU tar) 1.15.1
$ 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
■[perl]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のコンパイラがないよ!って怒られてビルドできなかったので、macportsでgccを別途インストールしても動かなくて探してたら同じ現象の人がいた。
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を探してダウンロード&インストール。





