下载源码
获取源码基本就两种,
- 官网下载
- github 克隆
如果选择官网下载可以 [点击这里] [node_download_url]下载
github 克隆
首先你要保证你的电脑或者服务器上有git
git clone https://github.com/nodejs/node.git
这里注意 一下 标签和版本,我不清楚那个版本,所以直接从官网下载稳定版的。
下载完成 直接解压 tar xf node(按TAB键)
我使用的环境是阿里云 的 CentOS 7.4 64位
安装了 php + nginx
我们一般直接 ./configure
其他配置 默认就ok了。
接下来 make && make install
就可以了。
配置文件所有选项
Options:
-h, --help show this help message and exit
--prefix=PREFIX select the install prefix [default: /usr/local]
--coverage Build node with code coverage enabled
--debug also build debug build
--dest-cpu=DEST_CPU CPU architecture to build for (arm, arm64, ia32, mips,
mipsel, mips64el, ppc, ppc64, x32, x64, x86, x86_64,
s390, s390x)
--cross-compiling force build to be considered as cross compiled
--no-cross-compiling force build to be considered as NOT cross compiled
--dest-os=DEST_OS operating system to build for (win, mac, solaris,
freebsd, openbsd, linux, android, aix)
--gdb add gdb support
--no-ifaddrs use on deprecated SunOS systems that do not support
ifaddrs.h
--fully-static Generate an executable without external dynamic
libraries. This will not work on OSX when using the
default compilation environment
--partly-static Generate an executable with libgcc and libstdc++
libraries. This will not work on OSX when using the
default compilation environment
--enable-vtune-profiling
Enable profiling support for Intel VTune profiler to
profile JavaScript code executed in nodejs. This
feature is only available for x32, x86, and x64
architectures.
--link-module=LINKED_MODULE
Path to a JS file to be bundled in the binary as a
builtin. This module will be referenced by path
without extension; e.g. /root/x/y.js will be
referenced via require('root/x/y'). Can be used
multiple times
--openssl-no-asm Do not build optimized assembly for OpenSSL
--openssl-fips=OPENSSL_FIPS
Build OpenSSL using FIPS canister .o file in supplied
folder
--openssl-use-def-ca-store
Use OpenSSL supplied CA store instead of compiled-in
Mozilla CA copy.
--openssl-system-ca-path=OPENSSL_SYSTEM_CA_PATH
Use the specified path to system CA (PEM format) in
addition to the OpenSSL supplied CA store or compiled-
in Mozilla CA copy.
--systemtap-includes=SYSTEMTAP_INCLUDES
directory containing systemtap header files
--tag=TAG custom build tag
--release-urlbase=RELEASE_URLBASE
Provide a custom URL prefix for the `process.release`
properties `sourceUrl` and `headersUrl`. When
compiling a release build, this will default to
https://nodejs.org/download/release/
--enable-trace-maps Enable the --trace-maps flag in V8 (use at your own
risk)
--v8-options=V8_OPTIONS
v8 options to pass, see `node --v8-options` for
examples.
--with-arm-float-abi=ARM_FLOAT_ABI
specifies which floating-point ABI to use (soft,
softfp, hard).
--with-arm-fpu=ARM_FPU
ARM FPU mode (vfp, vfpv3, vfpv3-d16, neon) [default:
none]
--with-mips-arch-variant=MIPS_ARCH_VARIANT
MIPS arch variant (loongson, r1, r2, r6, rx) [default:
r2]
--with-mips-fpu-mode=MIPS_FPU_MODE
MIPS FPU mode (fp32, fp64, fpxx) [default: fp32]
--with-mips-float-abi=MIPS_FLOAT_ABI
MIPS floating-point ABI (soft, hard) [default: hard]
--with-dtrace build with DTrace (default is true on sunos and
darwin)
--with-lttng build with Lttng (Only supported on Linux)
--with-etw build with ETW (default is true on Windows)
--with-perfctr build with performance counters (default is true on
Windows)
--without-dtrace build without DTrace
--without-etw build without ETW
--without-npm do not install the bundled npm (package manager)
--without-perfctr build without performance counters
--without-ssl build without SSL (disables crypto, https, inspector,
etc.)
--without-node-options
build without NODE_OPTIONS support
--xcode generate build files for use with xcode
--ninja generate build files for use with Ninja
--enable-asan build with asan
--enable-static build as static library
--no-browser-globals do not export browser globals like setTimeout,
console, etc. (This mode is not officially supported
for regular applications)
--without-inspector disable the V8 inspector protocol
--shared compile shared library for embedding node in another
project. (This mode is not officially supported for
regular applications)
--without-v8-platform
do not initialize v8 platform during node.js startup.
(This mode is not officially supported for regular
applications)
--without-bundled-v8 do not use V8 includes from the bundled deps folder.
(This mode is not officially supported for regular
applications)
Shared libraries:
Flags that allows you to control whether you want to build against
built-in dependencies or its shared representations. If necessary,
provide multiple libraries with comma.
--shared-http-parser
link to a shared http_parser DLL instead of static
linking
--shared-http-parser-includes=SHARED_HTTP_PARSER_INCLUDES
directory containing http_parser header files
--shared-http-parser-libname=SHARED_HTTP_PARSER_LIBNAME
alternative lib name to link to [default: http_parser]
--shared-http-parser-libpath=SHARED_HTTP_PARSER_LIBPATH
a directory to search for the shared http_parser DLL
--shared-libuv link to a shared libuv DLL instead of static linking
--shared-libuv-includes=SHARED_LIBUV_INCLUDES
directory containing libuv header files
--shared-libuv-libname=SHARED_LIBUV_LIBNAME
alternative lib name to link to [default: uv]
--shared-libuv-libpath=SHARED_LIBUV_LIBPATH
a directory to search for the shared libuv DLL
--shared-nghttp2 link to a shared nghttp2 DLL instead of static linking
--shared-nghttp2-includes=SHARED_NGHTTP2_INCLUDES
directory containing nghttp2 header files
--shared-nghttp2-libname=SHARED_NGHTTP2_LIBNAME
alternative lib name to link to [default: nghttp2]
--shared-nghttp2-libpath=SHARED_NGHTTP2_LIBPATH
a directory to search for the shared nghttp2 DLLs
--shared-openssl link to a shared OpenSSl DLL instead of static linking
--shared-openssl-includes=SHARED_OPENSSL_INCLUDES
directory containing OpenSSL header files
--shared-openssl-libname=SHARED_OPENSSL_LIBNAME
alternative lib name to link to [default: crypto,ssl]
--shared-openssl-libpath=SHARED_OPENSSL_LIBPATH
a directory to search for the shared OpenSSL DLLs
--shared-zlib link to a shared zlib DLL instead of static linking
--shared-zlib-includes=SHARED_ZLIB_INCLUDES
directory containing zlib header files
--shared-zlib-libname=SHARED_ZLIB_LIBNAME
alternative lib name to link to [default: z]
--shared-zlib-libpath=SHARED_ZLIB_LIBPATH
a directory to search for the shared zlib DLL
--shared-cares link to a shared cares DLL instead of static linking
--shared-cares-includes=SHARED_LIBCARES_INCLUDES
directory containing cares header files
--shared-cares-libname=SHARED_LIBCARES_LIBNAME
alternative lib name to link to [default: cares]
--shared-cares-libpath=SHARED_LIBCARES_LIBPATH
a directory to search for the shared cares DLL
Internationalization:
Flags that lets you enable i18n features in Node.js as well as which
library you want to build against.
--with-intl=WITH_INTL
Intl mode (valid choices: none, small-icu, full-icu,
system-icu) [default: small-icu]
--without-intl Disable Intl, same as --with-intl=none (disables
inspector)
--with-icu-path=WITH_ICU_PATH
Path to icu.gyp (ICU i18n, Chromium version only.)
--with-icu-locales=WITH_ICU_LOCALES
Comma-separated list of locales for "small-icu".
"root" is assumed. [default: root,en]
--with-icu-source=WITH_ICU_SOURCE
Intl mode: optional local path to icu/ dir, or
path/URL of icu source archive.
--download=DOWNLOAD_LIST
Select which packages may be auto-downloaded. valid
values are: none, all, icu. (default is "none").
--download-path=DOWNLOAD_PATH
Download directory [default: deps]
HTTP2:
Flags that allows you to control HTTP2 features in Node.js
--debug-http2 build with http2 debug statements on (default is
false)
--debug-nghttp2 build nghttp2 with DEBUGBUILD (default is false)
评论已关闭