Depending on what platform or features you require the build process may differ slightly. After you've successfully built a binary, running the test suite to validate that the binary works as intended is a good next step.
If you consistently can reproduce a test failure, search for it in the Node.js issue tracker or file a new issue.
Prerequisites:
gcc
andg++
4.8 or newer, orclang
andclang++
3.4 or newer- Python 2.6 or 2.7
- GNU Make 3.81 or newer
On OS X, you will also need:
- Xcode
- You also need to install the
Command Line Tools
via Xcode. You can find this under the menuXcode -> Preferences -> Downloads
- This step will install
gcc
and the related toolchain containingmake
- You also need to install the
On FreeBSD and OpenBSD, you may also need:
- libexecinfo (FreeBSD and OpenBSD only)
$ ./configure
$ make
$ [sudo] make install
If your Python binary is in a non-standard location or has a non-standard name, run the following instead:
$ export PYTHON=/path/to/python
$ $PYTHON ./configure
$ make
$ [sudo] make install
To run the tests:
$ make test
To run the native module tests:
$ make test-addons
To run the npm test suite:
note: to run the suite on node v4 or earlier you must first
run make install
$ make test-npm
To build the documentation:
This will build Node.js first (if necessary) and then use it to build the docs:
$ make doc
If you have an existing Node.js you can build just the docs with:
$ NODE=node make doc-only
(Where node
is the path to your executable.)
To read the documentation:
$ man doc/node.1
To test if Node.js was built correctly:
$ node -e "console.log('Hello from Node.js ' + process.version)"
Prerequisites:
- Python 2.6 or 2.7
- One of:
- Visual C++ Build Tools
- Visual Studio 2013 / 2015, all editions including the Community edition
- Visual Studio Express 2013 / 2015 for Desktop
- Basic Unix tools required for some tests,
Git for Windows includes Git Bash
and tools which can be included in the global
PATH
.
> vcbuild nosign
To run the tests:
> vcbuild test
To test if Node.js was built correctly:
> Release\node -e "console.log('Hello from Node.js', process.version)"
Although these instructions for building on Android are provided, please note that Android is not an officially supported platform at this time. Patches to improve the Android build are accepted. However, there is no testing on Android in the current continuous integration environment. The participation of people dedicated and determined to improve Android building, testing, and support is encouraged.
Be sure you have downloaded and extracted [Android NDK] (https://developer.android.com/tools/sdk/ndk/index.html) before in a folder. Then run:
$ ./android-configure /path/to/your/android-ndk
$ make
Intl support is not enabled by default.
This option will build with "small" (English only) support, but
the full Intl
(ECMA-402) APIs. With --download=all
it will
download the ICU library as needed.
$ ./configure --with-intl=small-icu --download=all
> vcbuild small-icu download-all
The small-icu
mode builds with English-only data. You can add full
data at runtime.
Note: more docs are on the node wiki.
With the --download=all
, this may download ICU if you don't have an
ICU in deps/icu
.
$ ./configure --with-intl=full-icu --download=all
> vcbuild full-icu download-all
The Intl
object will not be available. This is the default at
present, so this option is not normally needed.
$ ./configure --with-intl=none
> vcbuild intl-none
$ pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu
If you are cross compiling, your pkg-config
must be able to supply a path
that works for both your host and target environments.
You can find other ICU releases at
the ICU homepage.
Download the file named something like icu4c-**##.#**-src.tgz
(or
.zip
).
# from an already-unpacked ICU:
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu
# from a local ICU tarball
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz
# from a tarball URL
$ ./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz
First unpack latest ICU to deps/icu
icu4c-##.#-src.tgz (or .zip
)
as deps/icu
(You'll have: deps/icu/source/...
)
> vcbuild full-icu
NOTE: Windows is not yet supported
It is possible to build Node.js with OpenSSL FIPS module.
Note: building in this way does not allow you to claim that the runtime is FIPS 140-2 validated. Instead you can indicate that the runtime uses a validated module. See the security policy page 60 for more details. In addition, the validation for the underlying module is only valid if it is deployed in accordance with its security policy. If you need FIPS validated cryptography it is recommended that you read both the security policy and user guide.
- Obtain a copy of openssl-fips-x.x.x.tar.gz.
To comply with the security policy you must ensure the path
through which you get the file complies with the requirements
for a "secure installation" as described in section 6.6 in
the user guide.
For evaluation/experimentation you can simply download and verify
openssl-fips-x.x.x.tar.gz
from https://www.openssl.org/source/ - Extract source to
openssl-fips
folder andcd openssl-fips
./config
make
make install
(NOTE: to comply with the security policy you must use the exact commands in steps 3-5 without any additional options as per Appendix A in the security policy. The only exception is that./config no-asm
can be used in place of./config
, and the FIPSDIR environment variable may be used to specify a non-standard install folder for the validated module, as per User Guide sections 4.2.1, 4.2.2, and 4.2.3.- Get into Node.js checkout folder
./configure --openssl-fips=/path/to/openssl-fips/installdir
For example on ubuntu 12 the installation directory was /usr/local/ssl/fips-2.0- Build Node.js with
make -j
- Verify with
node -p "process.versions.openssl"
(1.0.2a-fips
)