[英]Installing node.js on CentOS 5
I'm pretty new to CentOS (5) and also node.js, but I already got an older version of node.js to work on my virtual server.我对 CentOS (5) 和 node.js 还是很陌生,但我已经有了旧版本的 node.js 可以在我的虚拟服务器上工作。 Now I'm trying to install a newer version, and I know that CentOS needs Python 2.4 while node needs 2.6 or newer, so I installed Python 2.7 using altinstall.
现在我正在尝试安装更新的版本,我知道 CentOS 需要 Python 2.4 而节点需要 2.6 或更高版本,所以我使用 ZA7F5F35426B92741173231B56altinstall21 安装了 ZA7F5F35426B92741173231B563821。
But even if I set an alias for Python that points to version 2.7 before running./configure, I still get this error:但即使我在运行./configure 之前为 Python 设置了指向 2.7 版本的别名,我仍然会收到此错误:
/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
That's the content of./configure:这就是./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 $?"
And at the top of wscript there is the following line: "#./usr/bin/env python", I also tried replacing that with something else, though I think it should work when using a Python alias在 wscript 的顶部有以下行:“#./usr/bin/env python”,我也尝试用其他东西替换它,尽管我认为它应该在使用 Python 别名时工作
Any ideas what I need to do to get this to work?有什么想法我需要做些什么才能让它发挥作用?
Thanks!谢谢!
I have python 2.7.3 'altinstalled' on Centos 5.x, with the binary named "/usr/local/bin/python2.7"我在 Centos 5.x 上安装了 python 2.7.3 'altinstalled',二进制文件名为“/usr/local/bin/python2.7”
I compile and install nodejs v0.8.16 using:我使用以下命令编译和安装 nodejs v0.8.16:
PYTHON=/usr/local/bin/python2.7
export PYTHON
python2.7 configure && make && make install
(I still had to identify and install missing development modules one by one before the install would succeed) (我仍然必须在安装成功之前一一识别并安装缺少的开发模块)
I changed the PATH in bash_profile to include the path to the desired version of python as follows:我更改了 bash_profile 中的 PATH 以包含所需版本的 python 的路径,如下所示:
vi ~/.bash_profile vi ~/.bash_profile
replace PATH=$PATH:$HOME/bin替换 PATH=$PATH:$HOME/bin
with PATH=/usr/local/python272/bin:$PATH:$HOME/bin使用 PATH=/usr/local/python272/bin:$PATH:$HOME/bin
source ~/.bash_profile源〜/ .bash_profile
./configure 。/配置
make制作
It picks up the correct python version.它选择正确的 python 版本。 No need to change wscript
无需更改 wscript
I'm on CentOS 5.6, python 2.7.2 (installed in /usr/local/python272) and using node.js 0.4.12我正在使用 CentOS 5.6、python 2.7.2(安装在 /usr/local/python272 中)并使用 node.js 0.4.12
I ran into this same exact problem.我遇到了同样的问题。 I wound up editing the wscript file and changed that line (222) from this:
我最终编辑了 wscript 文件并从此更改了该行(222):
"-pre" if node_is_release == "0" else ""
...to this: ...对此:
""
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.