Install node.js on CentOS 5

I am new to CentOS (5) as well as node.js, but I already have an old version of node.js to work on my virtual server. Now I'm trying to install a newer version, and I know that CentOS needs Python 2.4, and node requires 2.6 or later, so I installed Python 2.7 using altinstall.

But even if I set an alias for Python that points to version 2.7 before running. / configure, I still get this error:

/root/node/wscript: error: Traceback (most recent call last):
  File "/root/node/tools/wafadmin/Utils.py", line 274, in load_module
    exec(compile(code, file_path, 'exec'), module.__dict__)
  File "/root/node/wscript", line 222
    "-pre" if node_is_release == "0" else ""
        ^
SyntaxError: invalid syntax

What is the content. / configure:

#! /bin/sh

# v8 doesn't like ccache
if [ ! -z "`echo $CC | grep ccache`" ]; then
  echo "Error: V8 doesn't like cache. Please set your CC env var to 'gcc'"
  echo "  (ba)sh: export CC=gcc"
  exit 1
fi

CUR_DIR=$PWD

#possible relative path
WORKINGDIR=`dirname $0`
cd "$WORKINGDIR"
#abs path
WORKINGDIR=`pwd`
cd "$CUR_DIR"

"${WORKINGDIR}/tools/waf-light" --jobs=1 configure $*

exit $?"

At the top of wscript is the following line: "#! / Usr / bin / env python". I also tried replacing this with something else, although I think it should work when using a Python alias

Any ideas what I need to do to get this to work?

Thank!

+5
3

python 2.7.3 "altinstalled" Centos 5.x, "/usr/local/bin/python2.7"

nodejs v0.8.16, :

PYTHON=/usr/local/bin/python2.7
export PYTHON
python2.7 configure && make && make install
  • configure python2.7 python
  • PYTHON env var make install python

( , )

+5

PATH bash_profile, python :

vi ~/.bash_profile
PATH = $PATH: $HOME/bin
PATH =/usr/local/python272/bin: $PATH: $HOME/bin
~/.bash_profile
. /configure

python. wscript

CentOS 5.6, python 2.7.2 ( /usr/local/python 272) node.js 0.4.12

+1

I ran into the same exact issue. I finished editing the wscript file and changed this line (222) to this:

"-pre" if node_is_release == "0" else ""

... to that:

""
0
source

All Articles