Paul King chronic tinkererer

Installing Socket.io, NPM, and Centos 5.x

Centos 5 ships with a pretty old version of tar, that's incapable of unpacking one of the socket.io dependencies: websocket-client-1.0.0.

If you try to npm install socket.io, you'll hit a bunch of errors like:

npm ERR! tar "-mvxpf" "-" "-o" "-C"
"/tmp/npm-1313157472906/1313157485167-0.7352736354805529/contents/package.npm" tar:
Ignoring unknown extended header keyword LIBARCHIVE.creationtime

The recommended solution to this problem is to "build a newer tar from source", but why dirty up your box if you don't have to?

The Fix

  1. Download this repacked tar of websocket-client-1.0.0
  2. Run npm install websocket-client-1.0.0.tar.gz
  3. Run npm install socket.io

Since the websocket-client dependency is now installed, this should install cleanly.

HowTo (if this post is out of date)

  1. Run npm install socket.io --verbose
  2. Note the temporary name of tgz above the first ERR line, e.g. /tmp/npm-1316407706414/1316407706414-0.07840410759672523/tmp.tgz.
  3. Search backward from that line to find the download source for that temporary filename, e.g. http://registry.npmjs.org/websocket-client/-/websocket-client-1.0.0.tgz
  4. Download that file to a box with a newer version of tar, and unpack the archive to an empty directory.
  5. Repack the archive: tar zcvf websocket-client-1.0.0.tar *
  6. Follow 'The Fix' steps, above.