• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Building Node.js with Ninja
2
3The purpose of this guide is to show how to build Node.js using [Ninja][], as
4doing so can be significantly quicker than using `make`. Please see
5[Ninja's site][Ninja] for installation instructions (Unix only).
6
7[Ninja][] is supported in the Makefile. Run `./configure --ninja` to configure
8the project to run the regular `make` commands with Ninja.
9
10For example, `make` will execute `ninja -C out/Release` internally
11to produce a compiled release binary, It will also execute
12`ln -fs out/Release/node node`, so that you can execute `./node` at
13the project's root.
14
15When running `make`, you will see output similar to the following
16if the build has succeeded:
17
18```console
19ninja: Entering directory `out/Release`
20[4/4] LINK node, POSTBUILDS
21```
22
23The bottom line will change while building, showing the progress as
24`[finished/total]` build steps. This is useful output that `make` does not
25produce and is one of the benefits of using Ninja. Also, Ninja will likely
26compile much faster than even `make -j4` (or
27`-j<number of processor threads on your machine>`). You can still pass the
28number of processes to run for [Ninja][] using the environment variable `JOBS`.
29This will be the equivalent to the `-j` parameter in the regular `make`:
30
31```bash
32JOBS=12 make
33```
34
35## Producing a debug build
36
37To create a debug build rather than a release build:
38
39```bash
40./configure --ninja --debug && make
41```
42
43[Ninja]: https://ninja-build.org/
44