Tag Archives: centos5

How to use a different version of python duing NPM install?

Salam (means Hello) :)

I have terminal access to a VPS running centos 5.9 and default python 2.4.3 installed. I also installed python 2.7.3 via these commands: (I used make altinstall instead of make install)

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xf Python-2.7.3.tgz
cd Python-2.7.3
./configure
make
make altinstall

then I installed node.js from source via these commands:

python2.7 ./configure
make
make install

The problem is, when I use npm install and try to install a node.js package which requires python > 2.4.3 I get this error:

gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v2.4.3, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:125:14)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:114:9

how should I "pass the --python switch to point to Python >= v2.5.0"?

How to use a different version of python duing NPM install?

Salam (means Hello) :)

I have terminal access to a VPS running centos 5.9 and default python 2.4.3 installed. I also installed python 2.7.3 via these commands: (I used make altinstall instead of make install)

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xf Python-2.7.3.tgz
cd Python-2.7.3
./configure
make
make altinstall

then I installed node.js from source via these commands:

python2.7 ./configure
make
make install

The problem is, when I use npm install and try to install a node.js package which requires python > 2.4.3 I get this error:

gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v2.4.3, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:125:14)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:114:9

how should I "pass the --python switch to point to Python >= v2.5.0"?

How to open a port below 1024 in Cent OS for socket.io?

I'm trying to open port 843 in my Cent OS 5.2, I added following line to etcsysconfigiptables :

-A INPUT -p tcp --dport 843 -j ACCEPT

and then updated my iptables service. I need to listen to that port in my node.js application which is running by root user via sudo node index.js command, but I still get forbidden port error when I try establish a connection through that port.

this is what I get by running sudo iptables -L -v :

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination                     
 2811  238K ACCEPT     tcp  --  any    any     anywhere             anywhere                                tcp dpt:http
  112  6224 ACCEPT     tcp  --  any    any     anywhere             anywhere                                tcp dpt:hbci
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere                                tcp dpt:843
   41  2124 ACCEPT     tcp  --  any    any     anywhere             anywhere                                state NEW tcp multiport dports 5901:5903,6001:6003
13093   13M ACCEPT     all  --  any    any     anywhere             anywhere                                state RELATED,ESTABLISHED
   26  3584 ACCEPT     icmp --  any    any     anywhere             anywhere                        
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere                        
  109  6404 ACCEPT     tcp  --  any    any     anywhere             anywhere                                state NEW tcp dpt:ssh
 888K   80M REJECT     all  --  any    any     anywhere             anywhere 

and this is outpou of sudo netstat -ptl | grep node:

tcp        0      0 *:843       *:*    LISTEN      12927/node
tcp        0      0 *:http      *:*    LISTEN      12927/node
tcp        0      0 *:10843     *:*    LISTEN      12927/node

and I try to listen to that port in socket.io with this code:

var io          = require('socket.io').listen(
                    843,
                    {   log: false,
                        flashPolicyServer: true,
                        transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling', 'jsonp-polling']
                    }
                );
io.sockets.on('connection', function(socket){
    // my event listeners
});

How to open a port below 1024 in Cent OS for socket.io?

I'm trying to open port 843 in my Cent OS 5.2, I added following line to etc\sysconfig\iptables :

-A INPUT -p tcp --dport 843 -j ACCEPT

and then updated my iptables service. I need to listen to that port in my node.js application which is running by root user via sudo node index.js command, but I still get forbidden port error when I try establish a connection through that port.

this is what I get by running sudo iptables -L -v :

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination                     
 2811  238K ACCEPT     tcp  --  any    any     anywhere             anywhere                                tcp dpt:http
  112  6224 ACCEPT     tcp  --  any    any     anywhere             anywhere                                tcp dpt:hbci
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere                                tcp dpt:843
   41  2124 ACCEPT     tcp  --  any    any     anywhere             anywhere                                state NEW tcp multiport dports 5901:5903,6001:6003
13093   13M ACCEPT     all  --  any    any     anywhere             anywhere                                state RELATED,ESTABLISHED
   26  3584 ACCEPT     icmp --  any    any     anywhere             anywhere                        
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere                        
  109  6404 ACCEPT     tcp  --  any    any     anywhere             anywhere                                state NEW tcp dpt:ssh
 888K   80M REJECT     all  --  any    any     anywhere             anywhere 

and this is outpou of sudo netstat -ptl | grep node:

tcp        0      0 *:843       *:*    LISTEN      12927/node
tcp        0      0 *:http      *:*    LISTEN      12927/node
tcp        0      0 *:10843     *:*    LISTEN      12927/node

and I try to listen to that port in socket.io with this code:

var io          = require('socket.io').listen(
                    843,
                    {   log: false,
                        flashPolicyServer: true,
                        transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling', 'jsonp-polling']
                    }
                );
io.sockets.on('connection', function(socket){
    // my event listeners
});