Centos 下安装node
踩过好多坑,下面的靠谱
1、根据如下图及官网查看 wget的url,比如 https://nodejs.org/dist/v9.3.0/node-v9.3.0-linux-x64.tar.gz
2、解压文件
(一)编译好的文件
1
2
3
4
5
|
tar xf node
-
v5.
10.1
-
linux
-
x64.tar.gz
-
C
/
usr
/
local
/
cd
/
usr
/
local
/
mv node
-
v5.
10.1
-
linux
-
x64
/
nodejs
ln
-
s
/
usr
/
local
/
nodejs
/
bin
/
node
/
usr
/
local
/
bin
ln
-
s
/
usr
/
local
/
nodejs
/
bin
/
npm
/
usr
/
local
/
bin
|
(二)通过源码编译
这种方式你下载的文件是Source code,由于我的linux版本是6.x的,默认的gcc-c++为4.4.7 版本,而下过来之后源码编译要求gcc-c++版本最低为4.8,于是我就去升级GCC-C++版本,结果因为是源码编译升级GCC-C++,编译了一个多小时,都没有编译完成!果断被坑...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
root>
# ./configure
WARNING: C
+
+
compiler too old, need g
+
+
4.8
or
clang
+
+
3.4
(CXX
=
g
+
+
)
creating .
/
icu_config.gypi
{
'target_defaults'
: {
'cflags'
: [],
'default_configuration'
:
'Release'
,
'defines'
: [],
'include_dirs'
: [],
'libraries'
: []},
'variables'
: {
'asan'
:
0
,
'gas_version'
:
'2.20'
,
'host_arch'
:
'x64'
,
'icu_small'
:
'false'
,
'node_byteorder'
:
'little'
,
'node_install_npm'
:
'true'
,
'node_prefix'
:
'/usr/local'
,
'node_release_urlbase'
: '',
'node_shared_http_parser'
:
'false'
,
'node_shared_libuv'
:
'false'
,
'node_shared_openssl'
:
'false'
,
'node_shared_zlib'
:
'false'
,
'node_tag'
: '',
'node_use_dtrace'
:
'false'
,
'node_use_etw'
:
'false'
,
'node_use_lttng'
:
'false'
,
'node_use_openssl'
:
'true'
,
'node_use_perfctr'
:
'false'
,
'openssl_fips'
: '',
'openssl_no_asm'
:
0
,
'target_arch'
:
'x64'
,
'uv_parent_path'
:
'/deps/uv/'
,
'uv_use_dtrace'
:
'false'
,
'v8_enable_gdbjit'
:
0
,
'v8_enable_i18n_support'
:
0
,
'v8_no_strict_aliasing'
:
1
,
'v8_optimized_debug'
:
0
,
'v8_random_seed'
:
0
,
'v8_use_snapshot'
:
'true'
,
'want_separate_host_toolset'
:
0
}}
creating .
/
config.gypi
creating .
/
config.mk
WARNING: warnings were emitted
in
the configure phase
|
以上请参考,详情转摘至 http://www.cnblogs.com/kevinchou/p/5405540.html ;