使用OpenSSL支持编译Node.js



大家好,正在尝试远程安装Node.js,请按照这里的说明

wget http://nodejs.org/dist/node-v0.4.10.tar.gz 
tar -zxvf node-v0.4.10.tar.gz 
cd node-v0.x.x 
./configure --prefix=~/node 
make 
make test 
make install

这应该会让我在~/node下安装nodejs,然而,在./configure --prefix=~/node期间,我在依赖性需求中遇到了这个问题:

node-v0.4.10]$ ./configure --prefix=~/node
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 program gcc or cc           : /usr/bin/gcc 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for gcc                         : ok  
Checking for library dl                  : yes 
Checking for openssl                     : not found 
Checking for function SSL_library_init   : not found 
Checking for header openssl/crypto.h     : not found 
/opt/server/node-v0.4.10/wscript:341: error: Could not autodetect OpenSSL support. Make sure OpenSSL development packages are installed. Use configure --without-ssl to disable this message.
[tomcat@test.dev node-v0.4.10]$ make
Project not configured (run 'waf configure' first)
make: *** [program] Error 1

我已经检查了打开的ssl是否在盒子上:

node-v0.4.10]$ openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013
 ~]$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) 

不确定它们的其他依赖项是什么,一直在寻找配置文件

Node.js已经为最流行的发行版打包。

如果我的猜测是正确的,并且您使用的是centos6或类似的,那么以下命令应该可以正常工作:

sudo yum install nodejs npm --enablerepo=epel

最新更新