Javascript – npm fails to build socket.io with Error “Not compatible with your version of node/npm: commander@0.5.0”

javascriptlinuxnode.jsnpmsocket.io

I cloned socket.io from https://github.com/LearnBoost/socket.io.git bit it fails with the following Message

npm http GET https://registry.npmjs.org/socket.io-client/0.9.2
npm http 304 https://registry.npmjs.org/socket.io-client/0.9.2
npm http GET https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/xmlhttprequest/1.2.2
npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.2.2
npm http 304 https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1

> ws@0.4.9 preinstall /usr/src/socket.io/node_modules/socket.io-client/node_modules/ws
> make

npm http GET https://registry.npmjs.org/zeparser/0.0.5
node-waf configure build
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
'configure' finished successfully (0.105s)
Waf: Entering directory `/usr/src/socket.io/node_modules/socket.io-client/node_modules/ws/build'
[1/4] cxx: src/validation.cc -> build/Release/src/validation_1.o
[2/4] cxx: src/bufferutil.cc -> build/Release/src/bufferutil_2.o
[3/4] cxx_link: build/Release/src/validation_1.o -> build/Release/validation.node
[4/4] cxx_link: build/Release/src/bufferutil_2.o -> build/Release/bufferutil.node
Waf: Leaving directory `/usr/src/socket.io/node_modules/socket.io-client/node_modules/ws/build'
'build' finished successfully (1.634s)
npm http GET https://registry.npmjs.org/commander/0.5.0
npm http GET https://registry.npmjs.org/options
npm http 304 https://registry.npmjs.org/zeparser/0.0.5
npm http GET https://registry.npmjs.org/zeparser/-/zeparser-0.0.5.tgz
npm http 304 https://registry.npmjs.org/options
npm http 304 https://registry.npmjs.org/commander/0.5.0
npm ERR! error rolling back ws@0.4.9 Error: ENOTEMPTY, rmdir '/usr/src/socket.io/node_modules/socket.io-client/node_modules/ws'
npm ERR! error rolling back socket.io-client@0.9.2 Error: ENOTEMPTY, rmdir '/usr/src/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/test'

npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: commander@0.5.0
npm ERR! Required: {"node":">= 0.4.x < 0.7.0"}
npm ERR! Actual:   {"npm":"1.1.10","node":"0.7.7-pre"}
npm ERR! 
npm ERR! System Linux 2.6.38-11-generic
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /usr/src/socket.io
npm ERR! node -v v0.7.7-pre
npm ERR! npm -v 1.1.10
npm ERR! code ENOTSUP
npm ERR! message Unsupported
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /usr/src/socket.io/npm-debug.log
npm not ok

My current version of node and npm is as follows

root@abhibhat-VirtualBox:/usr/src/socket.io# node -v
v0.7.7-pre
root@abhibhat-VirtualBox:/usr/src/socket.io# npm -v
1.1.10
root@abhibhat-VirtualBox:/usr/src/socket.io# 
root@abhibhat-VirtualBox:/usr/src/socket.io# uname -a
Linux abhibhat-VirtualBox 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:18:14 UTC 2011 i686 i686 i386 GNU/Linux
root@abhibhat-VirtualBox:/usr/src/socket.io# 

Is it that my node version is higher than the supported upper limit? If so what is the solution?

I am clueless as to how to proceed from here. Please !!HELP!!

Best Solution

npm -f install socket.io just solved the issue. I also checked package.json and there seems to be no upper limit "engines": { "node": ">= 0.4.0" }. Strangely I also had to issue npm -g list prior to issuing npm -f install, but how it solved the problem I am clueless.

Related Question