1# Building Node.js 2 3Depending on what platform or features you need, the build process may 4differ. After you've built a binary, running the 5test suite to confirm that the binary works as intended is a good next step. 6 7If you can reproduce a test failure, search for it in the 8[Node.js issue tracker](https://github.com/nodejs/node/issues) or 9file a new issue. 10 11## Table of contents 12 13* [Supported platforms](#supported-platforms) 14 * [Input](#input) 15 * [Strategy](#strategy) 16 * [Platform list](#platform-list) 17 * [Supported toolchains](#supported-toolchains) 18 * [Official binary platforms and toolchains](#official-binary-platforms-and-toolchains) 19 * [OpenSSL asm support](#openssl-asm-support) 20 * [Previous versions of this document](#previous-versions-of-this-document) 21* [Building Node.js on supported platforms](#building-nodejs-on-supported-platforms) 22 * [Note about Python](#note-about-python) 23 * [Unix and macOS](#unix-and-macos) 24 * [Unix prerequisites](#unix-prerequisites) 25 * [macOS prerequisites](#macos-prerequisites) 26 * [Building Node.js](#building-nodejs-1) 27 * [Installing Node.js](#installing-nodejs) 28 * [Running Tests](#running-tests) 29 * [Running Coverage](#running-coverage) 30 * [Building the documentation](#building-the-documentation) 31 * [Building a debug build](#building-a-debug-build) 32 * [Building an ASan build](#building-an-asan-build) 33 * [Speeding up frequent rebuilds when developing](#speeding-up-frequent-rebuilds-when-developing) 34 * [Troubleshooting Unix and macOS builds](#troubleshooting-unix-and-macos-builds) 35 * [Windows](#windows) 36 * [Prerequisites](#prerequisites) 37 * [Option 1: Manual install](#option-1-manual-install) 38 * [Option 2: Automated install with Boxstarter](#option-2-automated-install-with-boxstarter) 39 * [Building Node.js](#building-nodejs-2) 40 * [Android](#android) 41* [`Intl` (ECMA-402) support](#intl-ecma-402-support) 42 * [Build with full ICU support (all locales supported by ICU)](#build-with-full-icu-support-all-locales-supported-by-icu) 43 * [Unix/macOS](#unixmacos) 44 * [Windows](#windows-1) 45 * [Trimmed: `small-icu` (English only) support](#trimmed-small-icu-english-only-support) 46 * [Unix/macOS](#unixmacos-1) 47 * [Windows](#windows-2) 48 * [Building without Intl support](#building-without-intl-support) 49 * [Unix/macOS](#unixmacos-2) 50 * [Windows](#windows-3) 51 * [Use existing installed ICU (Unix/macOS only)](#use-existing-installed-icu-unixmacos-only) 52 * [Build with a specific ICU](#build-with-a-specific-icu) 53 * [Unix/macOS](#unixmacos-3) 54 * [Windows](#windows-4) 55* [Configuring OpenSSL config appname](#configure-openssl-appname) 56* [Building Node.js with FIPS-compliant OpenSSL](#building-nodejs-with-fips-compliant-openssl) 57* [Building Node.js with external core modules](#building-nodejs-with-external-core-modules) 58 * [Unix/macOS](#unixmacos-4) 59 * [Windows](#windows-5) 60* [Note for downstream distributors of Node.js](#note-for-downstream-distributors-of-nodejs) 61 62## Supported platforms 63 64This list of supported platforms is current as of the branch/release to 65which it belongs. 66 67### Input 68 69Node.js relies on V8 and libuv. We adopt a subset of their supported platforms. 70 71### Strategy 72 73There are three support tiers: 74 75* **Tier 1**: These platforms represent the majority of Node.js users. The 76 Node.js Build Working Group maintains infrastructure for full test coverage. 77 Test failures on tier 1 platforms will block releases. 78* **Tier 2**: These platforms represent smaller segments of the Node.js user 79 base. The Node.js Build Working Group maintains infrastructure for full test 80 coverage. Test failures on tier 2 platforms will block releases. 81 Infrastructure issues may delay the release of binaries for these platforms. 82* **Experimental**: May not compile or test suite may not pass. The core team 83 does not create releases for these platforms. Test failures on experimental 84 platforms do not block releases. Contributions to improve support for these 85 platforms are welcome. 86 87Platforms may move between tiers between major release lines. The table below 88will reflect those changes. 89 90### Platform list 91 92Node.js compilation/execution support depends on operating system, architecture, 93and libc version. The table below lists the support tier for each supported 94combination. A list of [supported compile toolchains](#supported-toolchains) is 95also supplied for tier 1 platforms. 96 97**For production applications, run Node.js on supported platforms only.** 98 99Node.js does not support a platform version if a vendor has expired support 100for it. In other words, Node.js does not support running on End-of-Life (EoL) 101platforms. This is true regardless of entries in the table below. 102 103| Operating System | Architectures | Versions | Support Type | Notes | 104| ---------------- | ---------------- | --------------------------------- | ----------------------------------------------- | ------------------------------------ | 105| GNU/Linux | x64 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 1 | e.g. Ubuntu 20.04, Debian 10, RHEL 8 | 106| GNU/Linux | x64 | kernel >= 3.10, musl >= 1.1.19 | Experimental | e.g. Alpine 3.8 | 107| GNU/Linux | x86 | kernel >= 3.10, glibc >= 2.17 | Experimental | Downgraded as of Node.js 10 | 108| GNU/Linux | arm64 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 1 | e.g. Ubuntu 20.04, Debian 10, RHEL 8 | 109| GNU/Linux | armv7 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 1 | e.g. Ubuntu 20.04, Debian 10 | 110| GNU/Linux | armv6 | kernel >= 4.14, glibc >= 2.24 | Experimental | Downgraded as of Node.js 12 | 111| GNU/Linux | ppc64le >=power8 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 2 | e.g. Ubuntu 20.04, RHEL 8 | 112| GNU/Linux | s390x | kernel >= 4.18[^1], glibc >= 2.28 | Tier 2 | e.g. RHEL 8 | 113| Windows | x64, x86 (WoW64) | >= Windows 10/Server 2016 | Tier 1 | [^2],[^3] | 114| Windows | x86 (native) | >= Windows 10/Server 2016 | Tier 1 (running) / Experimental (compiling)[^4] | | 115| Windows | x64, x86 | Windows 8.1/Server 2012 | Experimental | | 116| Windows | arm64 | >= Windows 10 | Tier 2 (compiling) / Experimental (running) | | 117| macOS | x64 | >= 10.15 | Tier 1 | For notes about compilation see [^5] | 118| macOS | arm64 | >= 11 | Tier 1 | | 119| SmartOS | x64 | >= 18 | Tier 2 | | 120| AIX | ppc64be >=power8 | >= 7.2 TL04 | Tier 2 | | 121| FreeBSD | x64 | >= 12.4 | Experimental | | 122 123[^1]: Older kernel versions may work. However official Node.js release 124 binaries are [built on RHEL 8 systems](#official-binary-platforms-and-toolchains) 125 with kernel 4.18. 126 127[^2]: On Windows, running Node.js in Windows terminal emulators 128 like `mintty` requires the usage of [winpty](https://github.com/rprichard/winpty) 129 for the tty channels to work (e.g. `winpty node.exe script.js`). 130 In "Git bash" if you call the node shell alias (`node` without the `.exe` 131 extension), `winpty` is used automatically. 132 133[^3]: The Windows Subsystem for Linux (WSL) is not 134 supported, but the GNU/Linux build process and binaries should work. The 135 community will only address issues that reproduce on native GNU/Linux 136 systems. Issues that only reproduce on WSL should be reported in the 137 [WSL issue tracker](https://github.com/Microsoft/WSL/issues). Running the 138 Windows binary (`node.exe`) in WSL will not work without workarounds such as 139 stdio redirection. 140 141[^4]: Running Node.js on x86 Windows should work and binaries 142 are provided. However, tests in our infrastructure only run on WoW64. 143 Furthermore, compiling on x86 Windows is Experimental and 144 may not be possible. 145 146[^5]: Our macOS x64 Binaries are compiled with 10.15 as a target. Xcode11 is 147 required to compile. 148 149### Supported toolchains 150 151Depending on the host platform, the selection of toolchains may vary. 152 153| Operating System | Compiler Versions | 154| ---------------- | -------------------------------------------------------------- | 155| Linux | GCC >= 8.3 | 156| Windows | Visual Studio >= 2019 with the Windows 10 SDK on a 64-bit host | 157| macOS | Xcode >= 11 (Apple LLVM >= 11) | 158 159### Official binary platforms and toolchains 160 161Binaries at <https://nodejs.org/download/release/> are produced on: 162 163| Binary package | Platform and Toolchain | 164| ----------------------- | ------------------------------------------------------------------------------------------------------------- | 165| aix-ppc64 | AIX 7.2 TL04 on PPC64BE with GCC 8 | 166| darwin-x64 | macOS 10.15, Xcode Command Line Tools 11 with -mmacosx-version-min=10.15 | 167| darwin-arm64 (and .pkg) | macOS 11 (arm64), Xcode Command Line Tools 12 with -mmacosx-version-min=10.15 | 168| linux-arm64 | RHEL 8 with GCC 8[^6] | 169| linux-armv7l | Cross-compiled on Ubuntu 18.04 x64 with [custom GCC toolchain](https://github.com/rvagg/rpi-newer-crosstools) | 170| linux-ppc64le | RHEL 8 with GCC 8[^6] | 171| linux-s390x | RHEL 8 with GCC 8[^6] | 172| linux-x64 | RHEL 8 with GCC 8[^6] | 173| win-x64 and win-x86 | Windows 2012 R2 (x64) with Visual Studio 2019 | 174 175[^6]: Binaries produced on these systems are compatible with glibc >= 2.28 176 and libstdc++ >= 6.0.25 (`GLIBCXX_3.4.25`). These are available on 177 distributions natively supporting GCC 8.1 or higher, such as Debian 10, 178 RHEL 8 and Ubuntu 20.04. 179 180#### OpenSSL asm support 181 182OpenSSL-1.1.1 requires the following assembler version for use of asm 183support on x86\_64 and ia32. 184 185For use of AVX-512, 186 187* gas (GNU assembler) version 2.26 or higher 188* nasm version 2.11.8 or higher in Windows 189 190AVX-512 is disabled for Skylake-X by OpenSSL-1.1.1. 191 192For use of AVX2, 193 194* gas (GNU assembler) version 2.23 or higher 195* Xcode version 5.0 or higher 196* llvm version 3.3 or higher 197* nasm version 2.10 or higher in Windows 198 199Please refer to 200<https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html> for details. 201 202If compiling without one of the above, use `configure` with the 203`--openssl-no-asm` flag. Otherwise, `configure` will fail. 204 205### Previous versions of this document 206 207Supported platforms and toolchains change with each major version of Node.js. 208This document is only valid for the current major version of Node.js. 209Consult previous versions of this document for older versions of Node.js: 210 211* [Node.js 19](https://github.com/nodejs/node/blob/v19.x/BUILDING.md) 212* [Node.js 18](https://github.com/nodejs/node/blob/v18.x/BUILDING.md) 213* [Node.js 16](https://github.com/nodejs/node/blob/v16.x/BUILDING.md) 214 215## Building Node.js on supported platforms 216 217### Note about Python 218 219The Node.js project supports Python >= 3 for building and testing. 220 221### Unix and macOS 222 223#### Unix prerequisites 224 225* `gcc` and `g++` >= 8.3 or newer 226* GNU Make 3.81 or newer 227* Python >=3.6 <=3.11 (see note above) 228 * For test coverage, your Python installation must include pip. 229 230Installation via Linux package manager can be achieved with: 231 232* Ubuntu, Debian: `sudo apt-get install python3 g++ make python3-pip` 233* Fedora: `sudo dnf install python3 gcc-c++ make python3-pip` 234* CentOS and RHEL: `sudo yum install python3 gcc-c++ make python3-pip` 235* OpenSUSE: `sudo zypper install python3 gcc-c++ make python3-pip` 236* Arch Linux, Manjaro: `sudo pacman -S python gcc make python-pip` 237 238FreeBSD and OpenBSD users may also need to install `libexecinfo`. 239 240#### macOS prerequisites 241 242* Xcode Command Line Tools >= 11 for macOS 243* Python >=3.6 <=3.11 (see note above) 244 * For test coverage, your Python installation must include pip. 245 246macOS users can install the `Xcode Command Line Tools` by running 247`xcode-select --install`. Alternatively, if you already have the full Xcode 248installed, you can find them under the menu `Xcode -> Open Developer Tool -> 249More Developer Tools...`. This step will install `clang`, `clang++`, and 250`make`. 251 252#### Building Node.js 253 254If the path to your build directory contains a space, the build will likely 255fail. 256 257To build Node.js: 258 259```console 260$ ./configure 261$ make -j4 262``` 263 264We can speed up the builds by using [Ninja](https://ninja-build.org/). For more 265information, see 266[Building Node.js with Ninja](doc/contributing/building-node-with-ninja.md). 267 268The `-j4` option will cause `make` to run 4 simultaneous compilation jobs which 269may reduce build time. For more information, see the 270[GNU Make Documentation](https://www.gnu.org/software/make/manual/html_node/Parallel.html). 271 272The above requires that `python` resolves to a supported version of 273Python. See [Prerequisites](#prerequisites). 274 275After building, setting up [firewall rules](tools/macos-firewall.sh) can avoid 276popups asking to accept incoming network connections when running tests. 277 278Running the following script on macOS will add the firewall rules for the 279executable `node` in the `out` directory and the symbolic `node` link in the 280project's root directory. 281 282```console 283$ sudo ./tools/macos-firewall.sh 284``` 285 286#### Installing Node.js 287 288To install this version of Node.js into a system directory: 289 290```bash 291[sudo] make install 292``` 293 294#### Running tests 295 296To verify the build: 297 298```console 299$ make test-only 300``` 301 302At this point, you are ready to make code changes and re-run the tests. 303 304If you are running tests before submitting a pull request, use: 305 306```console 307$ make -j4 test 308``` 309 310`make -j4 test` does a full check on the codebase, including running linters and 311documentation tests. 312 313To run the linter without running tests, use 314`make lint`/`vcbuild lint`. It will lint JavaScript, C++, and Markdown files. 315 316If you are updating tests and want to run tests in a single test file 317(e.g. `test/parallel/test-stream2-transform.js`): 318 319```text 320$ tools/test.py test/parallel/test-stream2-transform.js 321``` 322 323You can execute the entire suite of tests for a given subsystem 324by providing the name of a subsystem: 325 326```text 327$ tools/test.py child-process 328``` 329 330You can also execute the tests in a test suite directory 331(such as `test/message`): 332 333```text 334$ tools/test.py test/message 335``` 336 337If you want to check the other options, please refer to the help by using 338the `--help` option: 339 340```text 341$ tools/test.py --help 342``` 343 344> Note: On Windows you should use `python3` executable. 345> Example: `python3 tools/test.py test/message` 346 347You can usually run tests directly with node: 348 349```text 350$ ./node test/parallel/test-stream2-transform.js 351``` 352 353> Info: `./node` points to your local Node.js build. 354 355Remember to recompile with `make -j4` in between test runs if you change code in 356the `lib` or `src` directories. 357 358The tests attempt to detect support for IPv6 and exclude IPv6 tests if 359appropriate. If your main interface has IPv6 addresses, then your 360loopback interface must also have '::1' enabled. For some default installations 361on Ubuntu, that does not seem to be the case. To enable '::1' on the 362loopback interface on Ubuntu: 363 364```bash 365sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 366``` 367 368You can use 369[node-code-ide-configs](https://github.com/nodejs/node-code-ide-configs) 370to run/debug tests if your IDE configs are present. 371 372#### Running coverage 373 374It's good practice to ensure any code you add or change is covered by tests. 375You can do so by running the test suite with coverage enabled: 376 377```console 378$ ./configure --coverage 379$ make coverage 380``` 381 382A detailed coverage report will be written to `coverage/index.html` for 383JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage. 384 385If you only want to run the JavaScript tests then you do not need to run 386the first command (`./configure --coverage`). Run `make coverage-run-js`, 387to execute JavaScript tests independently of the C++ test suite: 388 389```text 390$ make coverage-run-js 391``` 392 393If you are updating tests and want to collect coverage for a single test file 394(e.g. `test/parallel/test-stream2-transform.js`): 395 396```text 397$ make coverage-clean 398$ NODE_V8_COVERAGE=coverage/tmp tools/test.py test/parallel/test-stream2-transform.js 399$ make coverage-report-js 400``` 401 402You can collect coverage for the entire suite of tests for a given subsystem 403by providing the name of a subsystem: 404 405```text 406$ make coverage-clean 407$ NODE_V8_COVERAGE=coverage/tmp tools/test.py --mode=release child-process 408$ make coverage-report-js 409``` 410 411The `make coverage` command downloads some tools to the project root directory. 412To clean up after generating the coverage reports: 413 414```console 415$ make coverage-clean 416``` 417 418#### Building the documentation 419 420To build the documentation: 421 422This will build Node.js first (if necessary) and then use it to build the docs: 423 424```bash 425make doc 426``` 427 428If you have an existing Node.js build, you can build just the docs with: 429 430```bash 431NODE=/path/to/node make doc-only 432``` 433 434To read the man page: 435 436```bash 437man doc/node.1 438``` 439 440If you prefer to read the full documentation in a browser, run the following. 441 442```bash 443make docserve 444``` 445 446This will spin up a static file server and provide a URL to where you may browse 447the documentation locally. 448 449If you're comfortable viewing the documentation using the program your operating 450system has associated with the default web browser, run the following. 451 452```bash 453make docopen 454``` 455 456This will open a file URL to a one-page version of all the browsable HTML 457documents using the default browser. 458 459To test if Node.js was built correctly: 460 461```bash 462./node -e "console.log('Hello from Node.js ' + process.version)" 463``` 464 465#### Building a debug build 466 467If you run into an issue where the information provided by the JS stack trace 468is not enough, or if you suspect the error happens outside of the JS VM, you 469can try to build a debug enabled binary: 470 471```console 472$ ./configure --debug 473$ make -j4 474``` 475 476`make` with `./configure --debug` generates two binaries, the regular release 477one in `out/Release/node` and a debug binary in `out/Debug/node`, only the 478release version is actually installed when you run `make install`. 479 480To use the debug build with all the normal dependencies overwrite the release 481version in the install directory: 482 483```console 484$ make install PREFIX=/opt/node-debug/ 485$ cp -a -f out/Debug/node /opt/node-debug/node 486``` 487 488When using the debug binary, core dumps will be generated in case of crashes. 489These core dumps are useful for debugging when provided with the 490corresponding original debug binary and system information. 491 492Reading the core dump requires `gdb` built on the same platform the core dump 493was captured on (i.e. 64-bit `gdb` for `node` built on a 64-bit system, Linux 494`gdb` for `node` built on Linux) otherwise you will get errors like 495`not in executable format: File format not recognized`. 496 497Example of generating a backtrace from the core dump: 498 499```console 500$ gdb /opt/node-debug/node core.node.8.1535359906 501$ backtrace 502``` 503 504#### Building an ASan build 505 506[ASan](https://github.com/google/sanitizers) can help detect various memory 507related bugs. ASan builds are currently only supported on linux. 508If you want to check it on Windows or macOS or you want a consistent toolchain 509on Linux, you can try [Docker](https://www.docker.com/products/docker-desktop) 510(using an image like `gengjiawen/node-build:2020-02-14`). 511 512The `--debug` is not necessary and will slow down build and testing, but it can 513show clear stacktrace if ASan hits an issue. 514 515```console 516$ ./configure --debug --enable-asan && make -j4 517$ make test-only 518``` 519 520#### Speeding up frequent rebuilds when developing 521 522If you plan to frequently rebuild Node.js, especially if using several branches, 523installing `ccache` can help to greatly reduce build times. Set up with: 524 525On GNU/Linux: 526 527```bash 528sudo apt install ccache # for Debian/Ubuntu, included in most Linux distros 529export CC="ccache gcc" # add to your .profile 530export CXX="ccache g++" # add to your .profile 531``` 532 533On macOS: 534 535```bash 536brew install ccache # see https://brew.sh 537export CC="ccache cc" # add to ~/.zshrc or other shell config file 538export CXX="ccache c++" # add to ~/.zshrc or other shell config file 539``` 540 541This will allow for near-instantaneous rebuilds even when switching branches. 542 543When modifying only the JS layer in `lib`, it is possible to externally load it 544without modifying the executable: 545 546```console 547$ ./configure --node-builtin-modules-path "$(pwd)" 548``` 549 550The resulting binary won't include any JS files and will try to load them from 551the specified directory. The JS debugger of Visual Studio Code supports this 552configuration since the November 2020 version and allows for setting 553breakpoints. 554 555#### Troubleshooting Unix and macOS builds 556 557Stale builds can sometimes result in `file not found` errors while building. 558This and some other problems can be resolved with `make distclean`. The 559`distclean` recipe aggressively removes build artifacts. You will need to 560build again (`make -j4`). Since all build artifacts have been removed, this 561rebuild may take a lot more time than previous builds. Additionally, 562`distclean` removes the file that stores the results of `./configure`. If you 563ran `./configure` with non-default options (such as `--debug`), you will need 564to run it again before invoking `make -j4`. 565 566### Windows 567 568#### Prerequisites 569 570##### Option 1: Manual install 571 572* [Python 3.11](https://apps.microsoft.com/store/detail/python-311/9NRWMJP3717K) 573* The "Desktop development with C++" workload from 574 [Visual Studio 2019](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2019-and-other-products) or 575 the "C++ build tools" workload from the 576 [Build Tools](https://aka.ms/vs/16/release/vs_buildtools.exe), 577 with the default optional components 578* Basic Unix tools required for some tests, 579 [Git for Windows](https://git-scm.com/download/win) includes Git Bash 580 and tools which can be included in the global `PATH`. 581* The [NetWide Assembler](https://www.nasm.us/), for OpenSSL assembler modules. 582 If not installed in the default location, it needs to be manually added 583 to `PATH`. A build with the `openssl-no-asm` option does not need this, nor 584 does a build targeting ARM64 Windows. 585 586Optional requirements to build the MSI installer package: 587 588* The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the 589 [Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension) 590* The [WiX Toolset v3.14](https://wixtoolset.org/releases/) if 591 building for Windows 10 on ARM (ARM64) 592 593Optional requirements for compiling for Windows 10 on ARM (ARM64): 594 595* Visual Studio 15.9.0 or newer 596* Visual Studio optional components 597 * Visual C++ compilers and libraries for ARM64 598 * Visual C++ ATL for ARM64 599* Windows 10 SDK 10.0.17763.0 or newer 600 601##### Option 2: Automated install with Boxstarter 602 603A [Boxstarter](https://boxstarter.org/) script can be used for easy setup of 604Windows systems with all the required prerequisites for Node.js development. 605This script will install the following [Chocolatey](https://chocolatey.org/) 606packages: 607 608* [Git for Windows](https://chocolatey.org/packages/git) with the `git` and 609 Unix tools added to the `PATH` 610* [Python 3.x](https://chocolatey.org/packages/python) 611* [Visual Studio 2019 Build Tools](https://chocolatey.org/packages/visualstudio2019buildtools) 612 with [Visual C++ workload](https://chocolatey.org/packages/visualstudio2019-workload-vctools) 613* [NetWide Assembler](https://chocolatey.org/packages/nasm) 614 615To install Node.js prerequisites using 616[Boxstarter WebLauncher](https://boxstarter.org/weblauncher), open 617<https://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/HEAD/tools/bootstrap/windows_boxstarter> 618with Internet Explorer or Edge browser on the target machine. 619 620Alternatively, you can use PowerShell. Run those commands from an elevated 621PowerShell terminal: 622 623```powershell 624Set-ExecutionPolicy Unrestricted -Force 625iex ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1')) 626get-boxstarter -Force 627Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/HEAD/tools/bootstrap/windows_boxstarter -DisableReboots 628refreshenv 629``` 630 631The entire installation using Boxstarter will take up approximately 10 GB of 632disk space. 633 634#### Building Node.js 635 636If the path to your build directory contains a space or a non-ASCII character, 637the build will likely fail. 638 639```console 640> .\vcbuild 641``` 642 643To run the tests: 644 645```console 646> .\vcbuild test 647``` 648 649To test if Node.js was built correctly: 650 651```console 652> Release\node -e "console.log('Hello from Node.js', process.version)" 653``` 654 655### Android 656 657Android is not a supported platform. Patches to improve the Android build are 658welcome. There is no testing on Android in the current continuous integration 659environment. The participation of people dedicated and determined to improve 660Android building, testing, and support is encouraged. 661 662Be sure you have downloaded and extracted 663[Android NDK](https://developer.android.com/ndk) before in 664a folder. Then run: 665 666```console 667$ ./android-configure <path to the Android NDK> <Android SDK version> <target architecture> 668$ make -j4 669``` 670 671The Android SDK version should be at least 24 (Android 7.0) and the target 672architecture supports \[arm, arm64/aarch64, x86, x86\_64]. 673 674## `Intl` (ECMA-402) support 675 676[Intl](https://github.com/nodejs/node/blob/HEAD/doc/api/intl.md) support is 677enabled by default. 678 679### Build with full ICU support (all locales supported by ICU) 680 681This is the default option. 682 683#### Unix/macOS 684 685```console 686$ ./configure --with-intl=full-icu 687``` 688 689#### Windows 690 691```console 692> .\vcbuild full-icu 693``` 694 695### Trimmed: `small-icu` (English only) support 696 697In this configuration, only English data is included, but 698the full `Intl` (ECMA-402) APIs. It does not need to download 699any dependencies to function. You can add full data at runtime. 700 701#### Unix/macOS 702 703```console 704$ ./configure --with-intl=small-icu 705``` 706 707#### Windows 708 709```console 710> .\vcbuild small-icu 711``` 712 713### Building without Intl support 714 715The `Intl` object will not be available, nor some other APIs such as 716`String.normalize`. 717 718#### Unix/macOS 719 720```console 721$ ./configure --without-intl 722``` 723 724#### Windows 725 726```console 727> .\vcbuild without-intl 728``` 729 730### Use existing installed ICU (Unix/macOS only) 731 732```console 733$ pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu 734``` 735 736If you are cross-compiling, your `pkg-config` must be able to supply a path 737that works for both your host and target environments. 738 739### Build with a specific ICU 740 741You can find other ICU releases at 742[the ICU homepage](http://site.icu-project.org/download). 743Download the file named something like `icu4c-**##.#**-src.tgz` (or 744`.zip`). 745 746To check the minimum recommended ICU, run `./configure --help` and see 747the help for the `--with-icu-source` option. A warning will be printed 748during configuration if the ICU version is too old. 749 750#### Unix/macOS 751 752From an already-unpacked ICU: 753 754```console 755$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu 756``` 757 758From a local ICU tarball: 759 760```console 761$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz 762``` 763 764From a tarball URL: 765 766```console 767$ ./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz 768``` 769 770#### Windows 771 772First unpack latest ICU to `deps/icu` 773[icu4c-**##.#**-src.tgz](http://site.icu-project.org/download) (or `.zip`) 774as `deps/icu` (You'll have: `deps/icu/source/...`) 775 776```console 777> .\vcbuild full-icu 778``` 779 780### Configure OpenSSL appname 781 782Node.js can use an OpenSSL configuration file by specifying the environment 783variable `OPENSSL_CONF`, or using the command line option `--openssl-conf`, and 784if none of those are specified will default to reading the default OpenSSL 785configuration file `openssl.cnf`. Node.js will only read a section that is by 786default named `nodejs_conf`, but this name can be overridden using the following 787configure option: 788 789```console 790$ ./configure --openssl-conf-name=<some_conf_name> 791``` 792 793## Building Node.js with FIPS-compliant OpenSSL 794 795Node.js supports FIPS when statically or dynamically linked with OpenSSL 3 via 796[OpenSSL's provider model](https://www.openssl.org/docs/man3.0/man7/crypto.html#OPENSSL-PROVIDERS). 797It is not necessary to rebuild Node.js to enable support for FIPS. 798 799See [FIPS mode](./doc/api/crypto.md#fips-mode) for more information on how to 800enable FIPS support in Node.js. 801 802## Building Node.js with external core modules 803 804It is possible to specify one or more JavaScript text files to be bundled in 805the binary as built-in modules when building Node.js. 806 807### Unix/macOS 808 809This command will make `/root/myModule.js` available via 810`require('/root/myModule')` and `./myModule2.js` available via 811`require('myModule2')`. 812 813```console 814$ ./configure --link-module '/root/myModule.js' --link-module './myModule2.js' 815``` 816 817### Windows 818 819To make `./myModule.js` available via `require('myModule')` and 820`./myModule2.js` available via `require('myModule2')`: 821 822```console 823> .\vcbuild link-module './myModule.js' link-module './myModule2.js' 824``` 825 826## Building to use shared dependencies at runtime 827 828By default Node.js is built so that all dependencies are bundled into 829the Node.js binary itself. This provides a single binary that includes 830the correct versions of all dependencies on which it depends. 831 832Some Node.js distributions, however, prefer to manage dependencies. 833A number of `configure` options are provided to support this use case. 834 835* For dependencies with native code, the first set of options allow 836 Node.js to be built so that it uses a shared library 837 at runtime instead of building and including the dependency 838 in the Node.js binary itself. These options are in the 839 `Shared libraries` section of the `configure` help 840 (run `./configure --help` to get the complete list). 841 They provide the ability to enable the use of a shared library, 842 to set the name of the shared library, and to set the paths that 843 contain the include and shared library files. 844 845* For dependencies with JavaScript code (including WASM), the second 846 set of options allow the Node.js binary to be built so that it loads 847 the JavaScript for dependencies at runtime instead of being built into 848 the Node.js binary itself. These options are in the `Shared builtins` 849 section of the `configure` help 850 (run `./configure --help` to get the complete list). They 851 provide the ability to set the path to an external JavaScript file 852 for the dependency to be used at runtime. 853 854It is the responsibility of any distribution 855shipping with these options to: 856 857* ensure that the shared dependencies available at runtime 858 match what is expected by the Node.js binary. A 859 mismatch may result in crashes or unexpected behavior. 860* fully test that Node.js operates as expected with the 861 external dependencies. There may be little or no test coverage 862 within the Node.js project CI for these non-default options. 863 864## Note for downstream distributors of Node.js 865 866The Node.js ecosystem is reliant on ABI compatibility within a major release. 867To maintain ABI compatibility it is required that distributed builds of Node.js 868be built against the same version of dependencies, or similar versions that do 869not break their ABI compatibility, as those released by Node.js for any given 870`NODE_MODULE_VERSION` (located in `src/node_version.h`). 871 872When Node.js is built (with an intention to distribute) with an ABI 873incompatible with the official Node.js builds (e.g. using a ABI incompatible 874version of a dependency), please reserve and use a custom `NODE_MODULE_VERSION` 875by opening a pull request against the registry available at 876<https://github.com/nodejs/node/blob/HEAD/doc/abi_version_registry.json>. 877