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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="nodejs.org:node-version" content="v22.14.0">
<title>Command-line API | Node.js v22.14.0 Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic&display=fallback">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/hljs.css">
<link rel="canonical" href="https://nodejs.org/api/cli.html">
<script async defer src="assets/api.js" type="text/javascript"></script>
<script>
const storedTheme = localStorage.getItem('theme');
// Follow operating system theme preference
if (storedTheme === null && window.matchMedia) {
const mq = window.matchMedia('(prefers-color-scheme: dark)');
if (mq.matches) {
document.documentElement.classList.add('dark-mode');
}
} else if (storedTheme === 'dark') {
document.documentElement.classList.add('dark-mode');
}
</script>
<style>@media(max-width:478px){.with-32-chars>.js-flavor-toggle{float:none;margin:0 0 1em auto;}}</style>
</head>
<body class="alt apidoc" id="api-section-cli">
<a href="#apicontent" class="skip-to-content">Skip to content</a>
<div id="content" class="clearfix">
<div role="navigation" id="column2" class="interior">
<div id="intro" class="interior">
<a href="/" title="Go back to the home page">
Node.js
</a>
</div>
<ul>
<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>
</ul>
<hr class="line">
<ul>
<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li>
<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
<li><a href="addons.html" class="nav-addons">C++ addons</a></li>
<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li>
<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li>
<li><a href="child_process.html" class="nav-child_process">Child processes</a></li>
<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
<li><a href="cli.html" class="nav-cli active">Command-line options</a></li>
<li><a href="console.html" class="nav-console">Console</a></li>
<li><a href="corepack.html" class="nav-corepack">Corepack</a></li>
<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li>
<li><a href="dns.html" class="nav-dns">DNS</a></li>
<li><a href="domain.html" class="nav-domain">Domain</a></li>
<li><a href="errors.html" class="nav-errors">Errors</a></li>
<li><a href="events.html" class="nav-events">Events</a></li>
<li><a href="fs.html" class="nav-fs">File system</a></li>
<li><a href="globals.html" class="nav-globals">Globals</a></li>
<li><a href="http.html" class="nav-http">HTTP</a></li>
<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
<li><a href="https.html" class="nav-https">HTTPS</a></li>
<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li>
<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
<li><a href="typescript.html" class="nav-typescript">Modules: TypeScript</a></li>
<li><a href="net.html" class="nav-net">Net</a></li>
<li><a href="os.html" class="nav-os">OS</a></li>
<li><a href="path.html" class="nav-path">Path</a></li>
<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
<li><a href="permissions.html" class="nav-permissions">Permissions</a></li>
<li><a href="process.html" class="nav-process">Process</a></li>
<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
<li><a href="readline.html" class="nav-readline">Readline</a></li>
<li><a href="repl.html" class="nav-repl">REPL</a></li>
<li><a href="report.html" class="nav-report">Report</a></li>
<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li>
<li><a href="sqlite.html" class="nav-sqlite">SQLite</a></li>
<li><a href="stream.html" class="nav-stream">Stream</a></li>
<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
<li><a href="test.html" class="nav-test">Test runner</a></li>
<li><a href="timers.html" class="nav-timers">Timers</a></li>
<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
<li><a href="tty.html" class="nav-tty">TTY</a></li>
<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
<li><a href="url.html" class="nav-url">URL</a></li>
<li><a href="util.html" class="nav-util">Utilities</a></li>
<li><a href="v8.html" class="nav-v8">V8</a></li>
<li><a href="vm.html" class="nav-vm">VM</a></li>
<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
<li><a href="webcrypto.html" class="nav-webcrypto">Web Crypto API</a></li>
<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li>
<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
</ul>
<hr class="line">
<ul>
<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
</ul>
</div>
<div id="column1" data-id="cli" class="interior">
<header class="header">
<div class="header-container">
<h1>Node.js v22.14.0 documentation</h1>
<button class="theme-toggle-btn" id="theme-toggle-btn" title="Toggle dark mode/light mode" aria-label="Toggle dark mode/light mode" hidden>
<svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" height="24" width="24">
<path fill="none" d="M0 0h24v24H0z" />
<path d="M11.1 12.08c-2.33-4.51-.5-8.48.53-10.07C6.27 2.2 1.98 6.59 1.98 12c0 .14.02.28.02.42.62-.27 1.29-.42 2-.42 1.66 0 3.18.83 4.1 2.15A4.01 4.01 0 0111 18c0 1.52-.87 2.83-2.12 3.51.98.32 2.03.5 3.11.5 3.5 0 6.58-1.8 8.37-4.52-2.36.23-6.98-.97-9.26-5.41z"/>
<path d="M7 16h-.18C6.4 14.84 5.3 14 4 14c-1.66 0-3 1.34-3 3s1.34 3 3 3h3c1.1 0 2-.9 2-2s-.9-2-2-2z"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon" height="24" width="24">
<path d="M0 0h24v24H0z" fill="none" />
<path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"/>
</svg>
</button>
</div>
<div id="gtoc">
<ul>
<li class="pinned-header">Node.js v22.14.0</li>
<li class="picker-header">
<a href="#toc-picker" aria-controls="toc-picker">
<span class="picker-arrow"></span>
Table of contents
</a>
<div class="picker" tabindex="-1"><div class="toc"><ul id="toc-picker">
<li><a href="#command-line-api">Command-line API</a>
<ul>
<li><a href="#synopsis">Synopsis</a></li>
<li><a href="#program-entry-point">Program entry point</a>
<ul>
<li><a href="#ecmascript-modules-loader-entry-point-caveat">ECMAScript modules loader entry point caveat</a></li>
</ul>
</li>
<li><a href="#options">Options</a>
<ul>
<li><a href="#-"><code>-</code></a></li>
<li><a href="#--"><code>--</code></a></li>
<li><a href="#--abort-on-uncaught-exception"><code>--abort-on-uncaught-exception</code></a></li>
<li><span class="stability_1"><a href="#--allow-addons"><code>--allow-addons</code></a></span></li>
<li><span class="stability_1"><a href="#--allow-child-process"><code>--allow-child-process</code></a></span></li>
<li><span class="stability_2"><a href="#--allow-fs-read"><code>--allow-fs-read</code></a></span></li>
<li><span class="stability_2"><a href="#--allow-fs-write"><code>--allow-fs-write</code></a></span></li>
<li><span class="stability_1"><a href="#--allow-wasi"><code>--allow-wasi</code></a></span></li>
<li><span class="stability_1"><a href="#--allow-worker"><code>--allow-worker</code></a></span></li>
<li><span class="stability_1"><a href="#--build-snapshot"><code>--build-snapshot</code></a></span></li>
<li><span class="stability_1"><a href="#--build-snapshot-config"><code>--build-snapshot-config</code></a></span></li>
<li><a href="#-c---check"><code>-c</code>, <code>--check</code></a></li>
<li><a href="#--completion-bash"><code>--completion-bash</code></a></li>
<li><span class="stability_2"><a href="#-c-condition---conditionscondition"><code>-C condition</code>, <code>--conditions=condition</code></a></span></li>
<li><span class="stability_2"><a href="#--cpu-prof"><code>--cpu-prof</code></a></span></li>
<li><span class="stability_2"><a href="#--cpu-prof-dir"><code>--cpu-prof-dir</code></a></span></li>
<li><span class="stability_2"><a href="#--cpu-prof-interval"><code>--cpu-prof-interval</code></a></span></li>
<li><span class="stability_2"><a href="#--cpu-prof-name"><code>--cpu-prof-name</code></a></span></li>
<li><a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir=directory</code></a></li>
<li><a href="#--disable-protomode"><code>--disable-proto=mode</code></a></li>
<li><span class="stability_1"><a href="#--disable-sigusr1"><code>--disable-sigusr1</code></a></span></li>
<li><span class="stability_1"><a href="#--disable-warningcode-or-type"><code>--disable-warning=code-or-type</code></a></span></li>
<li><a href="#--disable-wasm-trap-handler"><code>--disable-wasm-trap-handler</code></a></li>
<li><a href="#--disallow-code-generation-from-strings"><code>--disallow-code-generation-from-strings</code></a></li>
<li><a href="#--dns-result-orderorder"><code>--dns-result-order=order</code></a></li>
<li><a href="#--enable-fips"><code>--enable-fips</code></a></li>
<li><a href="#--enable-network-family-autoselection"><code>--enable-network-family-autoselection</code></a></li>
<li><a href="#--enable-source-maps"><code>--enable-source-maps</code></a></li>
<li><span class="stability_1"><a href="#--entry-url"><code>--entry-url</code></a></span></li>
<li><a href="#--env-file-if-existsconfig"><code>--env-file-if-exists=config</code></a></li>
<li><span class="stability_1"><a href="#--env-fileconfig"><code>--env-file=config</code></a></span></li>
<li><a href="#-e---eval-script"><code>-e</code>, <code>--eval "script"</code></a></li>
<li><span class="stability_1"><a href="#--experimental-async-context-frame"><code>--experimental-async-context-frame</code></a></span></li>
<li><span class="stability_1"><a href="#--experimental-default-typetype"><code>--experimental-default-type=type</code></a></span></li>
<li><a href="#--experimental-eventsource"><code>--experimental-eventsource</code></a></li>
<li><a href="#--experimental-import-meta-resolve"><code>--experimental-import-meta-resolve</code></a></li>
<li><a href="#--experimental-loadermodule"><code>--experimental-loader=module</code></a></li>
<li><span class="stability_1"><a href="#--experimental-network-inspection"><code>--experimental-network-inspection</code></a></span></li>
<li><a href="#--experimental-print-required-tla"><code>--experimental-print-required-tla</code></a></li>
<li><span class="stability_1"><a href="#--experimental-require-module"><code>--experimental-require-module</code></a></span></li>
<li><span class="stability_1"><a href="#--experimental-sea-config"><code>--experimental-sea-config</code></a></span></li>
<li><a href="#--experimental-shadow-realm"><code>--experimental-shadow-realm</code></a></li>
<li><span class="stability_1"><a href="#--experimental-strip-types"><code>--experimental-strip-types</code></a></span></li>
<li><a href="#--experimental-test-coverage"><code>--experimental-test-coverage</code></a></li>
<li><span class="stability_1"><a href="#--experimental-test-isolationmode"><code>--experimental-test-isolation=mode</code></a></span></li>
<li><span class="stability_1"><a href="#--experimental-test-module-mocks"><code>--experimental-test-module-mocks</code></a></span></li>
<li><span class="stability_1"><a href="#--experimental-transform-types"><code>--experimental-transform-types</code></a></span></li>
<li><a href="#--experimental-vm-modules"><code>--experimental-vm-modules</code></a></li>
<li><a href="#--experimental-wasi-unstable-preview1"><code>--experimental-wasi-unstable-preview1</code></a></li>
<li><a href="#--experimental-wasm-modules"><code>--experimental-wasm-modules</code></a></li>
<li><a href="#--experimental-webstorage"><code>--experimental-webstorage</code></a></li>
<li><span class="stability_1"><a href="#--expose-gc"><code>--expose-gc</code></a></span></li>
<li><a href="#--force-context-aware"><code>--force-context-aware</code></a></li>
<li><a href="#--force-fips"><code>--force-fips</code></a></li>
<li><a href="#--force-node-api-uncaught-exceptions-policy"><code>--force-node-api-uncaught-exceptions-policy</code></a></li>
<li><span class="stability_1"><a href="#--frozen-intrinsics"><code>--frozen-intrinsics</code></a></span></li>
<li><span class="stability_2"><a href="#--heap-prof"><code>--heap-prof</code></a></span></li>
<li><span class="stability_2"><a href="#--heap-prof-dir"><code>--heap-prof-dir</code></a></span></li>
<li><span class="stability_2"><a href="#--heap-prof-interval"><code>--heap-prof-interval</code></a></span></li>
<li><span class="stability_2"><a href="#--heap-prof-name"><code>--heap-prof-name</code></a></span></li>
<li><span class="stability_1"><a href="#--heapsnapshot-near-heap-limitmax_count"><code>--heapsnapshot-near-heap-limit=max_count</code></a></span></li>
<li><a href="#--heapsnapshot-signalsignal"><code>--heapsnapshot-signal=signal</code></a></li>
<li><a href="#-h---help"><code>-h</code>, <code>--help</code></a></li>
<li><a href="#--icu-data-dirfile"><code>--icu-data-dir=file</code></a></li>
<li><span class="stability_1"><a href="#--importmodule"><code>--import=module</code></a></span></li>
<li><a href="#--input-typetype"><code>--input-type=type</code></a></li>
<li><a href="#--insecure-http-parser"><code>--insecure-http-parser</code></a></li>
<li><a href="#--inspect-brkhostport"><code>--inspect-brk[=[host:]port]</code></a></li>
<li><a href="#--inspect-porthostport"><code>--inspect-port=[host:]port</code></a></li>
<li><a href="#--inspect-publish-uidstderrhttp"><code>--inspect-publish-uid=stderr,http</code></a></li>
<li><a href="#--inspect-waithostport"><code>--inspect-wait[=[host:]port]</code></a></li>
<li><a href="#--inspecthostport"><code>--inspect[=[host:]port]</code></a>
<ul>
<li><a href="#warning-binding-inspector-to-a-public-ipport-combination-is-insecure">Warning: binding inspector to a public IP:port combination is insecure</a></li>
</ul>
</li>
<li><a href="#-i---interactive"><code>-i</code>, <code>--interactive</code></a></li>
<li><span class="stability_1"><a href="#--jitless"><code>--jitless</code></a></span></li>
<li><a href="#--localstorage-filefile"><code>--localstorage-file=file</code></a></li>
<li><a href="#--max-http-header-sizesize"><code>--max-http-header-size=size</code></a></li>
<li><a href="#--napi-modules"><code>--napi-modules</code></a></li>
<li><a href="#--network-family-autoselection-attempt-timeout"><code>--network-family-autoselection-attempt-timeout</code></a></li>
<li><a href="#--no-addons"><code>--no-addons</code></a></li>
<li><a href="#--no-deprecation"><code>--no-deprecation</code></a></li>
<li><a href="#--no-experimental-detect-module"><code>--no-experimental-detect-module</code></a></li>
<li><a href="#--no-experimental-fetch"><code>--no-experimental-fetch</code></a></li>
<li><a href="#--no-experimental-global-customevent"><code>--no-experimental-global-customevent</code></a></li>
<li><span class="stability_1"><a href="#--no-experimental-global-navigator"><code>--no-experimental-global-navigator</code></a></span></li>
<li><a href="#--no-experimental-global-webcrypto"><code>--no-experimental-global-webcrypto</code></a></li>
<li><a href="#--no-experimental-repl-await"><code>--no-experimental-repl-await</code></a></li>
<li><span class="stability_1"><a href="#--no-experimental-require-module"><code>--no-experimental-require-module</code></a></span></li>
<li><a href="#--no-experimental-sqlite"><code>--no-experimental-sqlite</code></a></li>
<li><a href="#--no-experimental-websocket"><code>--no-experimental-websocket</code></a></li>
<li><a href="#--no-extra-info-on-fatal-exception"><code>--no-extra-info-on-fatal-exception</code></a></li>
<li><a href="#--no-force-async-hooks-checks"><code>--no-force-async-hooks-checks</code></a></li>
<li><a href="#--no-global-search-paths"><code>--no-global-search-paths</code></a></li>
<li><a href="#--no-network-family-autoselection"><code>--no-network-family-autoselection</code></a></li>
<li><a href="#--no-warnings"><code>--no-warnings</code></a></li>
<li><a href="#--node-memory-debug"><code>--node-memory-debug</code></a></li>
<li><a href="#--openssl-configfile"><code>--openssl-config=file</code></a></li>
<li><a href="#--openssl-legacy-provider"><code>--openssl-legacy-provider</code></a></li>
<li><a href="#--openssl-shared-config"><code>--openssl-shared-config</code></a></li>
<li><a href="#--pending-deprecation"><code>--pending-deprecation</code></a></li>
<li><span class="stability_2"><a href="#--permission"><code>--permission</code></a></span></li>
<li><a href="#--preserve-symlinks"><code>--preserve-symlinks</code></a></li>
<li><a href="#--preserve-symlinks-main"><code>--preserve-symlinks-main</code></a></li>
<li><a href="#-p---print-script"><code>-p</code>, <code>--print "script"</code></a></li>
<li><a href="#--prof"><code>--prof</code></a></li>
<li><a href="#--prof-process"><code>--prof-process</code></a></li>
<li><a href="#--redirect-warningsfile"><code>--redirect-warnings=file</code></a></li>
<li><a href="#--report-compact"><code>--report-compact</code></a></li>
<li><a href="#--report-dirdirectory-report-directorydirectory"><code>--report-dir=directory</code>, <code>report-directory=directory</code></a></li>
<li><a href="#--report-exclude-env"><code>--report-exclude-env</code></a></li>
<li><a href="#--report-exclude-network"><code>--report-exclude-network</code></a></li>
<li><a href="#--report-filenamefilename"><code>--report-filename=filename</code></a></li>
<li><a href="#--report-on-fatalerror"><code>--report-on-fatalerror</code></a></li>
<li><a href="#--report-on-signal"><code>--report-on-signal</code></a></li>
<li><a href="#--report-signalsignal"><code>--report-signal=signal</code></a></li>
<li><a href="#--report-uncaught-exception"><code>--report-uncaught-exception</code></a></li>
<li><a href="#-r---require-module"><code>-r</code>, <code>--require module</code></a></li>
<li><span class="stability_2"><a href="#--run"><code>--run</code></a></span>
<ul>
<li><a href="#intentional-limitations">Intentional limitations</a></li>
<li><a href="#environment-variables">Environment variables</a></li>
</ul>
</li>
<li><a href="#--secure-heap-minn"><code>--secure-heap-min=n</code></a></li>
<li><a href="#--secure-heapn"><code>--secure-heap=n</code></a></li>
<li><span class="stability_1"><a href="#--snapshot-blobpath"><code>--snapshot-blob=path</code></a></span></li>
<li><a href="#--test"><code>--test</code></a></li>
<li><a href="#--test-concurrency"><code>--test-concurrency</code></a></li>
<li><span class="stability_1"><a href="#--test-coverage-branchesthreshold"><code>--test-coverage-branches=threshold</code></a></span></li>
<li><span class="stability_1"><a href="#--test-coverage-exclude"><code>--test-coverage-exclude</code></a></span></li>
<li><span class="stability_1"><a href="#--test-coverage-functionsthreshold"><code>--test-coverage-functions=threshold</code></a></span></li>
<li><span class="stability_1"><a href="#--test-coverage-include"><code>--test-coverage-include</code></a></span></li>
<li><span class="stability_1"><a href="#--test-coverage-linesthreshold"><code>--test-coverage-lines=threshold</code></a></span></li>
<li><a href="#--test-force-exit"><code>--test-force-exit</code></a></li>
<li><a href="#--test-name-pattern"><code>--test-name-pattern</code></a></li>
<li><a href="#--test-only"><code>--test-only</code></a></li>
<li><a href="#--test-reporter"><code>--test-reporter</code></a></li>
<li><a href="#--test-reporter-destination"><code>--test-reporter-destination</code></a></li>
<li><a href="#--test-shard"><code>--test-shard</code></a></li>
<li><a href="#--test-skip-pattern"><code>--test-skip-pattern</code></a></li>
<li><a href="#--test-timeout"><code>--test-timeout</code></a></li>
<li><a href="#--test-update-snapshots"><code>--test-update-snapshots</code></a></li>
<li><a href="#--throw-deprecation"><code>--throw-deprecation</code></a></li>
<li><a href="#--titletitle"><code>--title=title</code></a></li>
<li><a href="#--tls-cipher-listlist"><code>--tls-cipher-list=list</code></a></li>
<li><a href="#--tls-keylogfile"><code>--tls-keylog=file</code></a></li>
<li><a href="#--tls-max-v12"><code>--tls-max-v1.2</code></a></li>
<li><a href="#--tls-max-v13"><code>--tls-max-v1.3</code></a></li>
<li><a href="#--tls-min-v10"><code>--tls-min-v1.0</code></a></li>
<li><a href="#--tls-min-v11"><code>--tls-min-v1.1</code></a></li>
<li><a href="#--tls-min-v12"><code>--tls-min-v1.2</code></a></li>
<li><a href="#--tls-min-v13"><code>--tls-min-v1.3</code></a></li>
<li><span class="stability_0"><a href="#--trace-atomics-wait"><code>--trace-atomics-wait</code></a></span></li>
<li><a href="#--trace-deprecation"><code>--trace-deprecation</code></a></li>
<li><a href="#--trace-env"><code>--trace-env</code></a></li>
<li><a href="#--trace-env-js-stack"><code>--trace-env-js-stack</code></a></li>
<li><a href="#--trace-env-native-stack"><code>--trace-env-native-stack</code></a></li>
<li><a href="#--trace-event-categories"><code>--trace-event-categories</code></a></li>
<li><a href="#--trace-event-file-pattern"><code>--trace-event-file-pattern</code></a></li>
<li><a href="#--trace-events-enabled"><code>--trace-events-enabled</code></a></li>
<li><a href="#--trace-exit"><code>--trace-exit</code></a></li>
<li><a href="#--trace-require-modulemode"><code>--trace-require-module=mode</code></a></li>
<li><a href="#--trace-sigint"><code>--trace-sigint</code></a></li>
<li><a href="#--trace-sync-io"><code>--trace-sync-io</code></a></li>
<li><a href="#--trace-tls"><code>--trace-tls</code></a></li>
<li><a href="#--trace-uncaught"><code>--trace-uncaught</code></a></li>
<li><a href="#--trace-warnings"><code>--trace-warnings</code></a></li>
<li><a href="#--track-heap-objects"><code>--track-heap-objects</code></a></li>
<li><a href="#--unhandled-rejectionsmode"><code>--unhandled-rejections=mode</code></a></li>
<li><a href="#--use-bundled-ca---use-openssl-ca"><code>--use-bundled-ca</code>, <code>--use-openssl-ca</code></a></li>
<li><a href="#--use-largepagesmode"><code>--use-largepages=mode</code></a></li>
<li><a href="#--v8-options"><code>--v8-options</code></a></li>
<li><a href="#--v8-pool-sizenum"><code>--v8-pool-size=num</code></a></li>
<li><a href="#-v---version"><code>-v</code>, <code>--version</code></a></li>
<li><span class="stability_2"><a href="#--watch"><code>--watch</code></a></span></li>
<li><span class="stability_2"><a href="#--watch-path"><code>--watch-path</code></a></span></li>
<li><a href="#--watch-preserve-output"><code>--watch-preserve-output</code></a></li>
<li><a href="#--zero-fill-buffers"><code>--zero-fill-buffers</code></a></li>
</ul>
</li>
<li><a href="#environment-variables_1">Environment variables</a>
<ul>
<li><a href="#force_color1-2-3"><code>FORCE_COLOR=[1, 2, 3]</code></a></li>
<li><span class="stability_1"><a href="#node_compile_cachedir"><code>NODE_COMPILE_CACHE=dir</code></a></span></li>
<li><a href="#node_debugmodule"><code>NODE_DEBUG=module[,…]</code></a></li>
<li><a href="#node_debug_nativemodule"><code>NODE_DEBUG_NATIVE=module[,…]</code></a></li>
<li><a href="#node_disable_colors1"><code>NODE_DISABLE_COLORS=1</code></a></li>
<li><span class="stability_1"><a href="#node_disable_compile_cache1"><code>NODE_DISABLE_COMPILE_CACHE=1</code></a></span></li>
<li><a href="#node_extra_ca_certsfile"><code>NODE_EXTRA_CA_CERTS=file</code></a></li>
<li><a href="#node_icu_datafile"><code>NODE_ICU_DATA=file</code></a></li>
<li><a href="#node_no_warnings1"><code>NODE_NO_WARNINGS=1</code></a></li>
<li><a href="#node_optionsoptions"><code>NODE_OPTIONS=options...</code></a></li>
<li><a href="#node_pathpath"><code>NODE_PATH=path[:…]</code></a></li>
<li><a href="#node_pending_deprecation1"><code>NODE_PENDING_DEPRECATION=1</code></a></li>
<li><a href="#node_pending_pipe_instancesinstances"><code>NODE_PENDING_PIPE_INSTANCES=instances</code></a></li>
<li><a href="#node_preserve_symlinks1"><code>NODE_PRESERVE_SYMLINKS=1</code></a></li>
<li><a href="#node_redirect_warningsfile"><code>NODE_REDIRECT_WARNINGS=file</code></a></li>
<li><a href="#node_repl_external_modulefile"><code>NODE_REPL_EXTERNAL_MODULE=file</code></a></li>
<li><a href="#node_repl_historyfile"><code>NODE_REPL_HISTORY=file</code></a></li>
<li><a href="#node_skip_platform_checkvalue"><code>NODE_SKIP_PLATFORM_CHECK=value</code></a></li>
<li><a href="#node_test_contextvalue"><code>NODE_TEST_CONTEXT=value</code></a></li>
<li><a href="#node_tls_reject_unauthorizedvalue"><code>NODE_TLS_REJECT_UNAUTHORIZED=value</code></a></li>
<li><a href="#node_v8_coveragedir"><code>NODE_V8_COVERAGE=dir</code></a>
<ul>
<li><a href="#coverage-output">Coverage output</a></li>
<li><span class="stability_1"><a href="#source-map-cache">Source map cache</a></span></li>
</ul>
</li>
<li><a href="#no_colorany"><code>NO_COLOR=<any></code></a></li>
<li><a href="#openssl_conffile"><code>OPENSSL_CONF=file</code></a></li>
<li><a href="#ssl_cert_dirdir"><code>SSL_CERT_DIR=dir</code></a></li>
<li><a href="#ssl_cert_filefile"><code>SSL_CERT_FILE=file</code></a></li>
<li><a href="#tz"><code>TZ</code></a></li>
<li><a href="#uv_threadpool_sizesize"><code>UV_THREADPOOL_SIZE=size</code></a></li>
</ul>
</li>
<li><a href="#useful-v8-options">Useful V8 options</a>
<ul>
<li><a href="#--abort-on-uncaught-exception_1"><code>--abort-on-uncaught-exception</code></a></li>
<li><a href="#--disallow-code-generation-from-strings_1"><code>--disallow-code-generation-from-strings</code></a></li>
<li><a href="#--enable-etw-stack-walking"><code>--enable-etw-stack-walking</code></a></li>
<li><a href="#--expose-gc_1"><code>--expose-gc</code></a></li>
<li><a href="#--harmony-shadow-realm"><code>--harmony-shadow-realm</code></a></li>
<li><a href="#--huge-max-old-generation-size"><code>--huge-max-old-generation-size</code></a></li>
<li><a href="#--interpreted-frames-native-stack"><code>--interpreted-frames-native-stack</code></a></li>
<li><a href="#--jitless_1"><code>--jitless</code></a></li>
<li><a href="#--max-old-space-sizesize-in-mib"><code>--max-old-space-size=SIZE</code> (in MiB)</a></li>
<li><a href="#--max-semi-space-sizesize-in-mib"><code>--max-semi-space-size=SIZE</code> (in MiB)</a></li>
<li><a href="#--perf-basic-prof"><code>--perf-basic-prof</code></a></li>
<li><a href="#--perf-basic-prof-only-functions"><code>--perf-basic-prof-only-functions</code></a></li>
<li><a href="#--perf-prof"><code>--perf-prof</code></a></li>
<li><a href="#--perf-prof-unwinding-info"><code>--perf-prof-unwinding-info</code></a></li>
<li><a href="#--prof_1"><code>--prof</code></a></li>
<li><a href="#--security-revert"><code>--security-revert</code></a></li>
<li><a href="#--stack-trace-limitlimit"><code>--stack-trace-limit=limit</code></a></li>
</ul>
</li>
</ul>
</li>
</ul></div></div>
</li>
<li class="picker-header">
<a href="#gtoc-picker" aria-controls="gtoc-picker">
<span class="picker-arrow"></span>
Index
</a>
<div class="picker" tabindex="-1" id="gtoc-picker"><ul>
<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>
<li>
<a href="index.html">Index</a>
</li>
</ul>
<hr class="line">
<ul>
<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li>
<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
<li><a href="addons.html" class="nav-addons">C++ addons</a></li>
<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li>
<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li>
<li><a href="child_process.html" class="nav-child_process">Child processes</a></li>
<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
<li><a href="cli.html" class="nav-cli active">Command-line options</a></li>
<li><a href="console.html" class="nav-console">Console</a></li>
<li><a href="corepack.html" class="nav-corepack">Corepack</a></li>
<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li>
<li><a href="dns.html" class="nav-dns">DNS</a></li>
<li><a href="domain.html" class="nav-domain">Domain</a></li>
<li><a href="errors.html" class="nav-errors">Errors</a></li>
<li><a href="events.html" class="nav-events">Events</a></li>
<li><a href="fs.html" class="nav-fs">File system</a></li>
<li><a href="globals.html" class="nav-globals">Globals</a></li>
<li><a href="http.html" class="nav-http">HTTP</a></li>
<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
<li><a href="https.html" class="nav-https">HTTPS</a></li>
<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li>
<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
<li><a href="typescript.html" class="nav-typescript">Modules: TypeScript</a></li>
<li><a href="net.html" class="nav-net">Net</a></li>
<li><a href="os.html" class="nav-os">OS</a></li>
<li><a href="path.html" class="nav-path">Path</a></li>
<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
<li><a href="permissions.html" class="nav-permissions">Permissions</a></li>
<li><a href="process.html" class="nav-process">Process</a></li>
<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
<li><a href="readline.html" class="nav-readline">Readline</a></li>
<li><a href="repl.html" class="nav-repl">REPL</a></li>
<li><a href="report.html" class="nav-report">Report</a></li>
<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li>
<li><a href="sqlite.html" class="nav-sqlite">SQLite</a></li>
<li><a href="stream.html" class="nav-stream">Stream</a></li>
<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
<li><a href="test.html" class="nav-test">Test runner</a></li>
<li><a href="timers.html" class="nav-timers">Timers</a></li>
<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
<li><a href="tty.html" class="nav-tty">TTY</a></li>
<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
<li><a href="url.html" class="nav-url">URL</a></li>
<li><a href="util.html" class="nav-util">Utilities</a></li>
<li><a href="v8.html" class="nav-v8">V8</a></li>
<li><a href="vm.html" class="nav-vm">VM</a></li>
<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
<li><a href="webcrypto.html" class="nav-webcrypto">Web Crypto API</a></li>
<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li>
<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
</ul>
<hr class="line">
<ul>
<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
</ul></div>
</li>
<li class="picker-header">
<a href="#alt-docs" aria-controls="alt-docs">
<span class="picker-arrow"></span>
Other versions
</a>
<div class="picker" tabindex="-1"><ol id="alt-docs"><li><a href="https://nodejs.org/docs/latest-v23.x/api/cli.html">23.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v22.x/api/cli.html">22.x <b>LTS</b></a></li>
<li><a href="https://nodejs.org/docs/latest-v21.x/api/cli.html">21.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v20.x/api/cli.html">20.x <b>LTS</b></a></li>
<li><a href="https://nodejs.org/docs/latest-v19.x/api/cli.html">19.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v18.x/api/cli.html">18.x <b>LTS</b></a></li>
<li><a href="https://nodejs.org/docs/latest-v17.x/api/cli.html">17.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v16.x/api/cli.html">16.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v15.x/api/cli.html">15.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v14.x/api/cli.html">14.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v13.x/api/cli.html">13.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v12.x/api/cli.html">12.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v11.x/api/cli.html">11.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v10.x/api/cli.html">10.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v9.x/api/cli.html">9.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v8.x/api/cli.html">8.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v7.x/api/cli.html">7.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v6.x/api/cli.html">6.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v5.x/api/cli.html">5.x</a></li></ol></div>
</li>
<li class="picker-header">
<a href="#options-picker" aria-controls="options-picker">
<span class="picker-arrow"></span>
Options
</a>
<div class="picker" tabindex="-1">
<ul id="options-picker">
<li>
<a href="all.html">View on single page</a>
</li>
<li>
<a href="cli.json">View as JSON</a>
</li>
<li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/main/doc/api/cli.md">Edit on GitHub</a></li>
</ul>
</div>
</li>
</ul>
</div>
<hr>
</header>
<details role="navigation" id="toc" open><summary>Table of contents</summary><ul>
<li><a href="#command-line-api">Command-line API</a>
<ul>
<li><a href="#synopsis">Synopsis</a></li>
<li><a href="#program-entry-point">Program entry point</a>
<ul>
<li><a href="#ecmascript-modules-loader-entry-point-caveat">ECMAScript modules loader entry point caveat</a></li>
</ul>
</li>
<li><a href="#options">Options</a>
<ul>
<li><a href="#-"><code>-</code></a></li>
<li><a href="#--"><code>--</code></a></li>
<li><a href="#--abort-on-uncaught-exception"><code>--abort-on-uncaught-exception</code></a></li>
<li><span class="stability_1"><a href="#--allow-addons"><code>--allow-addons</code></a></span></li>
<li><span class="stability_1"><a href="#--allow-child-process"><code>--allow-child-process</code></a></span></li>
<li><span class="stability_2"><a href="#--allow-fs-read"><code>--allow-fs-read</code></a></span></li>
<li><span class="stability_2"><a href="#--allow-fs-write"><code>--allow-fs-write</code></a></span></li>
<li><span class="stability_1"><a href="#--allow-wasi"><code>--allow-wasi</code></a></span></li>
<li><span class="stability_1"><a href="#--allow-worker"><code>--allow-worker</code></a></span></li>
<li><span class="stability_1"><a href="#--build-snapshot"><code>--build-snapshot</code></a></span></li>
<li><span class="stability_1"><a href="#--build-snapshot-config"><code>--build-snapshot-config</code></a></span></li>
<li><a href="#-c---check"><code>-c</code>, <code>--check</code></a></li>
<li><a href="#--completion-bash"><code>--completion-bash</code></a></li>
<li><span class="stability_2"><a href="#-c-condition---conditionscondition"><code>-C condition</code>, <code>--conditions=condition</code></a></span></li>
<li><span class="stability_2"><a href="#--cpu-prof"><code>--cpu-prof</code></a></span></li>
<li><span class="stability_2"><a href="#--cpu-prof-dir"><code>--cpu-prof-dir</code></a></span></li>
<li><span class="stability_2"><a href="#--cpu-prof-interval"><code>--cpu-prof-interval</code></a></span></li>
<li><span class="stability_2"><a href="#--cpu-prof-name"><code>--cpu-prof-name</code></a></span></li>
<li><a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir=directory</code></a></li>
<li><a href="#--disable-protomode"><code>--disable-proto=mode</code></a></li>
<li><span class="stability_1"><a href="#--disable-sigusr1"><code>--disable-sigusr1</code></a></span></li>
<li><span class="stability_1"><a href="#--disable-warningcode-or-type"><code>--disable-warning=code-or-type</code></a></span></li>
<li><a href="#--disable-wasm-trap-handler"><code>--disable-wasm-trap-handler</code></a></li>
<li><a href="#--disallow-code-generation-from-strings"><code>--disallow-code-generation-from-strings</code></a></li>
<li><a href="#--dns-result-orderorder"><code>--dns-result-order=order</code></a></li>
<li><a href="#--enable-fips"><code>--enable-fips</code></a></li>
<li><a href="#--enable-network-family-autoselection"><code>--enable-network-family-autoselection</code></a></li>
<li><a href="#--enable-source-maps"><code>--enable-source-maps</code></a></li>
<li><span class="stability_1"><a href="#--entry-url"><code>--entry-url</code></a></span></li>
<li><a href="#--env-file-if-existsconfig"><code>--env-file-if-exists=config</code></a></li>
<li><span class="stability_1"><a href="#--env-fileconfig"><code>--env-file=config</code></a></span></li>
<li><a href="#-e---eval-script"><code>-e</code>, <code>--eval "script"</code></a></li>
<li><span class="stability_1"><a href="#--experimental-async-context-frame"><code>--experimental-async-context-frame</code></a></span></li>
<li><span class="stability_1"><a href="#--experimental-default-typetype"><code>--experimental-default-type=type</code></a></span></li>
<li><a href="#--experimental-eventsource"><code>--experimental-eventsource</code></a></li>
<li><a href="#--experimental-import-meta-resolve"><code>--experimental-import-meta-resolve</code></a></li>
<li><a href="#--experimental-loadermodule"><code>--experimental-loader=module</code></a></li>
<li><span class="stability_1"><a href="#--experimental-network-inspection"><code>--experimental-network-inspection</code></a></span></li>
<li><a href="#--experimental-print-required-tla"><code>--experimental-print-required-tla</code></a></li>
<li><span class="stability_1"><a href="#--experimental-require-module"><code>--experimental-require-module</code></a></span></li>
<li><span class="stability_1"><a href="#--experimental-sea-config"><code>--experimental-sea-config</code></a></span></li>
<li><a href="#--experimental-shadow-realm"><code>--experimental-shadow-realm</code></a></li>
<li><span class="stability_1"><a href="#--experimental-strip-types"><code>--experimental-strip-types</code></a></span></li>
<li><a href="#--experimental-test-coverage"><code>--experimental-test-coverage</code></a></li>
<li><span class="stability_1"><a href="#--experimental-test-isolationmode"><code>--experimental-test-isolation=mode</code></a></span></li>
<li><span class="stability_1"><a href="#--experimental-test-module-mocks"><code>--experimental-test-module-mocks</code></a></span></li>
<li><span class="stability_1"><a href="#--experimental-transform-types"><code>--experimental-transform-types</code></a></span></li>
<li><a href="#--experimental-vm-modules"><code>--experimental-vm-modules</code></a></li>
<li><a href="#--experimental-wasi-unstable-preview1"><code>--experimental-wasi-unstable-preview1</code></a></li>
<li><a href="#--experimental-wasm-modules"><code>--experimental-wasm-modules</code></a></li>
<li><a href="#--experimental-webstorage"><code>--experimental-webstorage</code></a></li>
<li><span class="stability_1"><a href="#--expose-gc"><code>--expose-gc</code></a></span></li>
<li><a href="#--force-context-aware"><code>--force-context-aware</code></a></li>
<li><a href="#--force-fips"><code>--force-fips</code></a></li>
<li><a href="#--force-node-api-uncaught-exceptions-policy"><code>--force-node-api-uncaught-exceptions-policy</code></a></li>
<li><span class="stability_1"><a href="#--frozen-intrinsics"><code>--frozen-intrinsics</code></a></span></li>
<li><span class="stability_2"><a href="#--heap-prof"><code>--heap-prof</code></a></span></li>
<li><span class="stability_2"><a href="#--heap-prof-dir"><code>--heap-prof-dir</code></a></span></li>
<li><span class="stability_2"><a href="#--heap-prof-interval"><code>--heap-prof-interval</code></a></span></li>
<li><span class="stability_2"><a href="#--heap-prof-name"><code>--heap-prof-name</code></a></span></li>
<li><span class="stability_1"><a href="#--heapsnapshot-near-heap-limitmax_count"><code>--heapsnapshot-near-heap-limit=max_count</code></a></span></li>
<li><a href="#--heapsnapshot-signalsignal"><code>--heapsnapshot-signal=signal</code></a></li>
<li><a href="#-h---help"><code>-h</code>, <code>--help</code></a></li>
<li><a href="#--icu-data-dirfile"><code>--icu-data-dir=file</code></a></li>
<li><span class="stability_1"><a href="#--importmodule"><code>--import=module</code></a></span></li>
<li><a href="#--input-typetype"><code>--input-type=type</code></a></li>
<li><a href="#--insecure-http-parser"><code>--insecure-http-parser</code></a></li>
<li><a href="#--inspect-brkhostport"><code>--inspect-brk[=[host:]port]</code></a></li>
<li><a href="#--inspect-porthostport"><code>--inspect-port=[host:]port</code></a></li>
<li><a href="#--inspect-publish-uidstderrhttp"><code>--inspect-publish-uid=stderr,http</code></a></li>
<li><a href="#--inspect-waithostport"><code>--inspect-wait[=[host:]port]</code></a></li>
<li><a href="#--inspecthostport"><code>--inspect[=[host:]port]</code></a>
<ul>
<li><a href="#warning-binding-inspector-to-a-public-ipport-combination-is-insecure">Warning: binding inspector to a public IP:port combination is insecure</a></li>
</ul>
</li>
<li><a href="#-i---interactive"><code>-i</code>, <code>--interactive</code></a></li>
<li><span class="stability_1"><a href="#--jitless"><code>--jitless</code></a></span></li>
<li><a href="#--localstorage-filefile"><code>--localstorage-file=file</code></a></li>
<li><a href="#--max-http-header-sizesize"><code>--max-http-header-size=size</code></a></li>
<li><a href="#--napi-modules"><code>--napi-modules</code></a></li>
<li><a href="#--network-family-autoselection-attempt-timeout"><code>--network-family-autoselection-attempt-timeout</code></a></li>
<li><a href="#--no-addons"><code>--no-addons</code></a></li>
<li><a href="#--no-deprecation"><code>--no-deprecation</code></a></li>
<li><a href="#--no-experimental-detect-module"><code>--no-experimental-detect-module</code></a></li>
<li><a href="#--no-experimental-fetch"><code>--no-experimental-fetch</code></a></li>
<li><a href="#--no-experimental-global-customevent"><code>--no-experimental-global-customevent</code></a></li>
<li><span class="stability_1"><a href="#--no-experimental-global-navigator"><code>--no-experimental-global-navigator</code></a></span></li>
<li><a href="#--no-experimental-global-webcrypto"><code>--no-experimental-global-webcrypto</code></a></li>
<li><a href="#--no-experimental-repl-await"><code>--no-experimental-repl-await</code></a></li>
<li><span class="stability_1"><a href="#--no-experimental-require-module"><code>--no-experimental-require-module</code></a></span></li>
<li><a href="#--no-experimental-sqlite"><code>--no-experimental-sqlite</code></a></li>
<li><a href="#--no-experimental-websocket"><code>--no-experimental-websocket</code></a></li>
<li><a href="#--no-extra-info-on-fatal-exception"><code>--no-extra-info-on-fatal-exception</code></a></li>
<li><a href="#--no-force-async-hooks-checks"><code>--no-force-async-hooks-checks</code></a></li>
<li><a href="#--no-global-search-paths"><code>--no-global-search-paths</code></a></li>
<li><a href="#--no-network-family-autoselection"><code>--no-network-family-autoselection</code></a></li>
<li><a href="#--no-warnings"><code>--no-warnings</code></a></li>
<li><a href="#--node-memory-debug"><code>--node-memory-debug</code></a></li>
<li><a href="#--openssl-configfile"><code>--openssl-config=file</code></a></li>
<li><a href="#--openssl-legacy-provider"><code>--openssl-legacy-provider</code></a></li>
<li><a href="#--openssl-shared-config"><code>--openssl-shared-config</code></a></li>
<li><a href="#--pending-deprecation"><code>--pending-deprecation</code></a></li>
<li><span class="stability_2"><a href="#--permission"><code>--permission</code></a></span></li>
<li><a href="#--preserve-symlinks"><code>--preserve-symlinks</code></a></li>
<li><a href="#--preserve-symlinks-main"><code>--preserve-symlinks-main</code></a></li>
<li><a href="#-p---print-script"><code>-p</code>, <code>--print "script"</code></a></li>
<li><a href="#--prof"><code>--prof</code></a></li>
<li><a href="#--prof-process"><code>--prof-process</code></a></li>
<li><a href="#--redirect-warningsfile"><code>--redirect-warnings=file</code></a></li>
<li><a href="#--report-compact"><code>--report-compact</code></a></li>
<li><a href="#--report-dirdirectory-report-directorydirectory"><code>--report-dir=directory</code>, <code>report-directory=directory</code></a></li>
<li><a href="#--report-exclude-env"><code>--report-exclude-env</code></a></li>
<li><a href="#--report-exclude-network"><code>--report-exclude-network</code></a></li>
<li><a href="#--report-filenamefilename"><code>--report-filename=filename</code></a></li>
<li><a href="#--report-on-fatalerror"><code>--report-on-fatalerror</code></a></li>
<li><a href="#--report-on-signal"><code>--report-on-signal</code></a></li>
<li><a href="#--report-signalsignal"><code>--report-signal=signal</code></a></li>
<li><a href="#--report-uncaught-exception"><code>--report-uncaught-exception</code></a></li>
<li><a href="#-r---require-module"><code>-r</code>, <code>--require module</code></a></li>
<li><span class="stability_2"><a href="#--run"><code>--run</code></a></span>
<ul>
<li><a href="#intentional-limitations">Intentional limitations</a></li>
<li><a href="#environment-variables">Environment variables</a></li>
</ul>
</li>
<li><a href="#--secure-heap-minn"><code>--secure-heap-min=n</code></a></li>
<li><a href="#--secure-heapn"><code>--secure-heap=n</code></a></li>
<li><span class="stability_1"><a href="#--snapshot-blobpath"><code>--snapshot-blob=path</code></a></span></li>
<li><a href="#--test"><code>--test</code></a></li>
<li><a href="#--test-concurrency"><code>--test-concurrency</code></a></li>
<li><span class="stability_1"><a href="#--test-coverage-branchesthreshold"><code>--test-coverage-branches=threshold</code></a></span></li>
<li><span class="stability_1"><a href="#--test-coverage-exclude"><code>--test-coverage-exclude</code></a></span></li>
<li><span class="stability_1"><a href="#--test-coverage-functionsthreshold"><code>--test-coverage-functions=threshold</code></a></span></li>
<li><span class="stability_1"><a href="#--test-coverage-include"><code>--test-coverage-include</code></a></span></li>
<li><span class="stability_1"><a href="#--test-coverage-linesthreshold"><code>--test-coverage-lines=threshold</code></a></span></li>
<li><a href="#--test-force-exit"><code>--test-force-exit</code></a></li>
<li><a href="#--test-name-pattern"><code>--test-name-pattern</code></a></li>
<li><a href="#--test-only"><code>--test-only</code></a></li>
<li><a href="#--test-reporter"><code>--test-reporter</code></a></li>
<li><a href="#--test-reporter-destination"><code>--test-reporter-destination</code></a></li>
<li><a href="#--test-shard"><code>--test-shard</code></a></li>
<li><a href="#--test-skip-pattern"><code>--test-skip-pattern</code></a></li>
<li><a href="#--test-timeout"><code>--test-timeout</code></a></li>
<li><a href="#--test-update-snapshots"><code>--test-update-snapshots</code></a></li>
<li><a href="#--throw-deprecation"><code>--throw-deprecation</code></a></li>
<li><a href="#--titletitle"><code>--title=title</code></a></li>
<li><a href="#--tls-cipher-listlist"><code>--tls-cipher-list=list</code></a></li>
<li><a href="#--tls-keylogfile"><code>--tls-keylog=file</code></a></li>
<li><a href="#--tls-max-v12"><code>--tls-max-v1.2</code></a></li>
<li><a href="#--tls-max-v13"><code>--tls-max-v1.3</code></a></li>
<li><a href="#--tls-min-v10"><code>--tls-min-v1.0</code></a></li>
<li><a href="#--tls-min-v11"><code>--tls-min-v1.1</code></a></li>
<li><a href="#--tls-min-v12"><code>--tls-min-v1.2</code></a></li>
<li><a href="#--tls-min-v13"><code>--tls-min-v1.3</code></a></li>
<li><span class="stability_0"><a href="#--trace-atomics-wait"><code>--trace-atomics-wait</code></a></span></li>
<li><a href="#--trace-deprecation"><code>--trace-deprecation</code></a></li>
<li><a href="#--trace-env"><code>--trace-env</code></a></li>
<li><a href="#--trace-env-js-stack"><code>--trace-env-js-stack</code></a></li>
<li><a href="#--trace-env-native-stack"><code>--trace-env-native-stack</code></a></li>
<li><a href="#--trace-event-categories"><code>--trace-event-categories</code></a></li>
<li><a href="#--trace-event-file-pattern"><code>--trace-event-file-pattern</code></a></li>
<li><a href="#--trace-events-enabled"><code>--trace-events-enabled</code></a></li>
<li><a href="#--trace-exit"><code>--trace-exit</code></a></li>
<li><a href="#--trace-require-modulemode"><code>--trace-require-module=mode</code></a></li>
<li><a href="#--trace-sigint"><code>--trace-sigint</code></a></li>
<li><a href="#--trace-sync-io"><code>--trace-sync-io</code></a></li>
<li><a href="#--trace-tls"><code>--trace-tls</code></a></li>
<li><a href="#--trace-uncaught"><code>--trace-uncaught</code></a></li>
<li><a href="#--trace-warnings"><code>--trace-warnings</code></a></li>
<li><a href="#--track-heap-objects"><code>--track-heap-objects</code></a></li>
<li><a href="#--unhandled-rejectionsmode"><code>--unhandled-rejections=mode</code></a></li>
<li><a href="#--use-bundled-ca---use-openssl-ca"><code>--use-bundled-ca</code>, <code>--use-openssl-ca</code></a></li>
<li><a href="#--use-largepagesmode"><code>--use-largepages=mode</code></a></li>
<li><a href="#--v8-options"><code>--v8-options</code></a></li>
<li><a href="#--v8-pool-sizenum"><code>--v8-pool-size=num</code></a></li>
<li><a href="#-v---version"><code>-v</code>, <code>--version</code></a></li>
<li><span class="stability_2"><a href="#--watch"><code>--watch</code></a></span></li>
<li><span class="stability_2"><a href="#--watch-path"><code>--watch-path</code></a></span></li>
<li><a href="#--watch-preserve-output"><code>--watch-preserve-output</code></a></li>
<li><a href="#--zero-fill-buffers"><code>--zero-fill-buffers</code></a></li>
</ul>
</li>
<li><a href="#environment-variables_1">Environment variables</a>
<ul>
<li><a href="#force_color1-2-3"><code>FORCE_COLOR=[1, 2, 3]</code></a></li>
<li><span class="stability_1"><a href="#node_compile_cachedir"><code>NODE_COMPILE_CACHE=dir</code></a></span></li>
<li><a href="#node_debugmodule"><code>NODE_DEBUG=module[,…]</code></a></li>
<li><a href="#node_debug_nativemodule"><code>NODE_DEBUG_NATIVE=module[,…]</code></a></li>
<li><a href="#node_disable_colors1"><code>NODE_DISABLE_COLORS=1</code></a></li>
<li><span class="stability_1"><a href="#node_disable_compile_cache1"><code>NODE_DISABLE_COMPILE_CACHE=1</code></a></span></li>
<li><a href="#node_extra_ca_certsfile"><code>NODE_EXTRA_CA_CERTS=file</code></a></li>
<li><a href="#node_icu_datafile"><code>NODE_ICU_DATA=file</code></a></li>
<li><a href="#node_no_warnings1"><code>NODE_NO_WARNINGS=1</code></a></li>
<li><a href="#node_optionsoptions"><code>NODE_OPTIONS=options...</code></a></li>
<li><a href="#node_pathpath"><code>NODE_PATH=path[:…]</code></a></li>
<li><a href="#node_pending_deprecation1"><code>NODE_PENDING_DEPRECATION=1</code></a></li>
<li><a href="#node_pending_pipe_instancesinstances"><code>NODE_PENDING_PIPE_INSTANCES=instances</code></a></li>
<li><a href="#node_preserve_symlinks1"><code>NODE_PRESERVE_SYMLINKS=1</code></a></li>
<li><a href="#node_redirect_warningsfile"><code>NODE_REDIRECT_WARNINGS=file</code></a></li>
<li><a href="#node_repl_external_modulefile"><code>NODE_REPL_EXTERNAL_MODULE=file</code></a></li>
<li><a href="#node_repl_historyfile"><code>NODE_REPL_HISTORY=file</code></a></li>
<li><a href="#node_skip_platform_checkvalue"><code>NODE_SKIP_PLATFORM_CHECK=value</code></a></li>
<li><a href="#node_test_contextvalue"><code>NODE_TEST_CONTEXT=value</code></a></li>
<li><a href="#node_tls_reject_unauthorizedvalue"><code>NODE_TLS_REJECT_UNAUTHORIZED=value</code></a></li>
<li><a href="#node_v8_coveragedir"><code>NODE_V8_COVERAGE=dir</code></a>
<ul>
<li><a href="#coverage-output">Coverage output</a></li>
<li><span class="stability_1"><a href="#source-map-cache">Source map cache</a></span></li>
</ul>
</li>
<li><a href="#no_colorany"><code>NO_COLOR=<any></code></a></li>
<li><a href="#openssl_conffile"><code>OPENSSL_CONF=file</code></a></li>
<li><a href="#ssl_cert_dirdir"><code>SSL_CERT_DIR=dir</code></a></li>
<li><a href="#ssl_cert_filefile"><code>SSL_CERT_FILE=file</code></a></li>
<li><a href="#tz"><code>TZ</code></a></li>
<li><a href="#uv_threadpool_sizesize"><code>UV_THREADPOOL_SIZE=size</code></a></li>
</ul>
</li>
<li><a href="#useful-v8-options">Useful V8 options</a>
<ul>
<li><a href="#--abort-on-uncaught-exception_1"><code>--abort-on-uncaught-exception</code></a></li>
<li><a href="#--disallow-code-generation-from-strings_1"><code>--disallow-code-generation-from-strings</code></a></li>
<li><a href="#--enable-etw-stack-walking"><code>--enable-etw-stack-walking</code></a></li>
<li><a href="#--expose-gc_1"><code>--expose-gc</code></a></li>
<li><a href="#--harmony-shadow-realm"><code>--harmony-shadow-realm</code></a></li>
<li><a href="#--huge-max-old-generation-size"><code>--huge-max-old-generation-size</code></a></li>
<li><a href="#--interpreted-frames-native-stack"><code>--interpreted-frames-native-stack</code></a></li>
<li><a href="#--jitless_1"><code>--jitless</code></a></li>
<li><a href="#--max-old-space-sizesize-in-mib"><code>--max-old-space-size=SIZE</code> (in MiB)</a></li>
<li><a href="#--max-semi-space-sizesize-in-mib"><code>--max-semi-space-size=SIZE</code> (in MiB)</a></li>
<li><a href="#--perf-basic-prof"><code>--perf-basic-prof</code></a></li>
<li><a href="#--perf-basic-prof-only-functions"><code>--perf-basic-prof-only-functions</code></a></li>
<li><a href="#--perf-prof"><code>--perf-prof</code></a></li>
<li><a href="#--perf-prof-unwinding-info"><code>--perf-prof-unwinding-info</code></a></li>
<li><a href="#--prof_1"><code>--prof</code></a></li>
<li><a href="#--security-revert"><code>--security-revert</code></a></li>
<li><a href="#--stack-trace-limitlimit"><code>--stack-trace-limit=limit</code></a></li>
</ul>
</li>
</ul>
</li>
</ul></details>
<div role="main" id="apicontent">
<h2>Command-line API<span><a class="mark" href="#command-line-api" id="command-line-api">#</a></span><a aria-hidden="true" class="legacy" id="cli_command_line_api"></a></h2>
<p>Node.js comes with a variety of CLI options. These options expose built-in
debugging, multiple ways to execute scripts, and other helpful runtime options.</p>
<p>To view this documentation as a manual page in a terminal, run <code>man node</code>.</p>
<section><h3>Synopsis<span><a class="mark" href="#synopsis" id="synopsis">#</a></span><a aria-hidden="true" class="legacy" id="cli_synopsis"></a></h3>
<p><code>node [options] [V8 options] [<program-entry-point> | -e "script" | -] [--] [arguments]</code></p>
<p><code>node inspect [<program-entry-point> | -e "script" | <host>:<port>] …</code></p>
<p><code>node --v8-options</code></p>
<p>Execute without arguments to start the <a href="repl.html">REPL</a>.</p>
<p>For more info about <code>node inspect</code>, see the <a href="debugger.html">debugger</a> documentation.</p>
</section><section><h3>Program entry point<span><a class="mark" href="#program-entry-point" id="program-entry-point">#</a></span><a aria-hidden="true" class="legacy" id="cli_program_entry_point"></a></h3>
<p>The program entry point is a specifier-like string. If the string is not an
absolute path, it's resolved as a relative path from the current working
directory. That path is then resolved by <a href="modules.html">CommonJS</a> module loader, or by the
<a href="packages.html#modules-loaders">ES module loader</a> if <a href="#--experimental-default-typetype"><code>--experimental-default-type=module</code></a>
is passed. If no corresponding file is found, an error is thrown.</p>
<p>If a file is found, its path will be passed to the
<a href="packages.html#modules-loaders">ES module loader</a> under any of the following conditions:</p>
<ul>
<li>The program was started with a command-line flag that forces the entry
point to be loaded with ECMAScript module loader, such as <code>--import</code> or
<a href="#--experimental-default-typetype"><code>--experimental-default-type=module</code></a>.</li>
<li>The file has an <code>.mjs</code> extension.</li>
<li>The file does not have a <code>.cjs</code> extension, and the nearest parent
<code>package.json</code> file contains a top-level <a href="packages.html#type"><code>"type"</code></a> field with a value of
<code>"module"</code>.</li>
</ul>
<p>Otherwise, the file is loaded using the CommonJS module loader. See
<a href="packages.html#modules-loaders">Modules loaders</a> for more details.</p>
<h4>ECMAScript modules loader entry point caveat<span><a class="mark" href="#ecmascript-modules-loader-entry-point-caveat" id="ecmascript-modules-loader-entry-point-caveat">#</a></span><a aria-hidden="true" class="legacy" id="cli_ecmascript_modules_loader_entry_point_caveat"></a></h4>
<p>When loading, the <a href="packages.html#modules-loaders">ES module loader</a> loads the program
entry point, the <code>node</code> command will accept as input only files with <code>.js</code>,
<code>.mjs</code>, or <code>.cjs</code> extensions; with <code>.wasm</code> extensions when
<a href="#--experimental-wasm-modules"><code>--experimental-wasm-modules</code></a> is enabled; and with no extension when
<a href="#--experimental-default-typetype"><code>--experimental-default-type=module</code></a> is passed.</p>
</section><section><h3>Options<span><a class="mark" href="#options" id="options">#</a></span><a aria-hidden="true" class="legacy" id="cli_options"></a></h3>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v10.12.0</td>
<td><p>Underscores instead of dashes are now allowed for Node.js options as well, in addition to V8 options.</p></td></tr>
</tbody></table>
</details>
</div>
<p>All options, including V8 options, allow words to be separated by both
dashes (<code>-</code>) or underscores (<code>_</code>). For example, <code>--pending-deprecation</code> is
equivalent to <code>--pending_deprecation</code>.</p>
<p>If an option that takes a single value (such as <code>--max-http-header-size</code>) is
passed more than once, then the last passed value is used. Options from the
command line take precedence over options passed through the <a href="#node_optionsoptions"><code>NODE_OPTIONS</code></a>
environment variable.</p>
<h4><code>-</code><span><a class="mark" href="#-" id="-">#</a></span><a aria-hidden="true" class="legacy" id="cli"></a></h4>
<div class="api_metadata">
<span>Added in: v8.0.0</span>
</div>
<p>Alias for stdin. Analogous to the use of <code>-</code> in other command-line utilities,
meaning that the script is read from stdin, and the rest of the options
are passed to that script.</p>
<h4><code>--</code><span><a class="mark" href="#--" id="--">#</a></span><a aria-hidden="true" class="legacy" id="cli_1"></a></h4>
<div class="api_metadata">
<span>Added in: v6.11.0</span>
</div>
<p>Indicate the end of node options. Pass the rest of the arguments to the script.
If no script filename or eval/print script is supplied prior to this, then
the next argument is used as a script filename.</p>
<h4><code>--abort-on-uncaught-exception</code><span><a class="mark" href="#--abort-on-uncaught-exception" id="--abort-on-uncaught-exception">#</a></span><a aria-hidden="true" class="legacy" id="cli_abort_on_uncaught_exception"></a></h4>
<div class="api_metadata">
<span>Added in: v0.10.8</span>
</div>
<p>Aborting instead of exiting causes a core file to be generated for post-mortem
analysis using a debugger (such as <code>lldb</code>, <code>gdb</code>, and <code>mdb</code>).</p>
<p>If this flag is passed, the behavior can still be set to not abort through
<a href="process.html#processsetuncaughtexceptioncapturecallbackfn"><code>process.setUncaughtExceptionCaptureCallback()</code></a> (and through usage of the
<code>node:domain</code> module that uses it).</p>
<h4><code>--allow-addons</code><span><a class="mark" href="#--allow-addons" id="--allow-addons">#</a></span><a aria-hidden="true" class="legacy" id="cli_allow_addons"></a></h4>
<div class="api_metadata">
<span>Added in: v21.6.0, v20.12.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active development</div><p></p>
<p>When using the <a href="permissions.html#permission-model">Permission Model</a>, the process will not be able to use
native addons by default.
Attempts to do so will throw an <code>ERR_DLOPEN_DISABLED</code> unless the
user explicitly passes the <code>--allow-addons</code> flag when starting Node.js.</p>
<p>Example:</p>
<pre><code class="language-js cjs"><span class="hljs-comment">// Attempt to require an native addon</span>
<span class="hljs-built_in">require</span>(<span class="hljs-string">'nodejs-addon-example'</span>);</code> <button class="copy-button">copy</button></pre>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --permission --allow-fs-read=* index.js</span>
node:internal/modules/cjs/loader:1319
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: Cannot load native addon because loading addons is disabled.
at Module._extensions..node (node:internal/modules/cjs/loader:1319:18)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at Object.<anonymous> (/home/index.js:1:15)
at Module._compile (node:internal/modules/cjs/loader:1233:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12) {
code: 'ERR_DLOPEN_DISABLED'
}</code> <button class="copy-button">copy</button></pre>
<h4><code>--allow-child-process</code><span><a class="mark" href="#--allow-child-process" id="--allow-child-process">#</a></span><a aria-hidden="true" class="legacy" id="cli_allow_child_process"></a></h4>
<div class="api_metadata">
<span>Added in: v20.0.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active development</div><p></p>
<p>When using the <a href="permissions.html#permission-model">Permission Model</a>, the process will not be able to spawn any
child process by default.
Attempts to do so will throw an <code>ERR_ACCESS_DENIED</code> unless the
user explicitly passes the <code>--allow-child-process</code> flag when starting Node.js.</p>
<p>Example:</p>
<pre><code class="language-js"><span class="hljs-keyword">const</span> childProcess = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:child_process'</span>);
<span class="hljs-comment">// Attempt to bypass the permission</span>
childProcess.<span class="hljs-title function_">spawn</span>(<span class="hljs-string">'node'</span>, [<span class="hljs-string">'-e'</span>, <span class="hljs-string">'require("fs").writeFileSync("/new-file", "example")'</span>]);</code> <button class="copy-button">copy</button></pre>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --permission --allow-fs-read=* index.js</span>
node:internal/child_process:388
const err = this._handle.spawn(options);
^
Error: Access to this API has been restricted
at ChildProcess.spawn (node:internal/child_process:388:28)
at node:internal/main/run_main_module:17:47 {
code: 'ERR_ACCESS_DENIED',
permission: 'ChildProcess'
}</code> <button class="copy-button">copy</button></pre>
<p>Unlike <code>child_process.spawn</code>, the <code>child_process.fork</code> API copies the execution
arguments from the parent process. This means that if you start Node.js with the
Permission Model enabled and include the <code>--allow-child-process</code> flag, calling
<code>child_process.fork()</code> will propagate all Permission Model flags to the child
process.</p>
<h4><code>--allow-fs-read</code><span><a class="mark" href="#--allow-fs-read" id="--allow-fs-read">#</a></span><a aria-hidden="true" class="legacy" id="cli_allow_fs_read"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.13.0</td>
<td><p>Permission Model and --allow-fs flags are stable.</p></td></tr>
<tr><td>v20.7.0</td>
<td><p>Paths delimited by comma (<code>,</code>) are no longer allowed.</p></td></tr>
<tr><td>v20.0.0</td>
<td><p><span>Added in: v20.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable.</div><p></p>
<p>This flag configures file system read permissions using
the <a href="permissions.html#permission-model">Permission Model</a>.</p>
<p>The valid arguments for the <code>--allow-fs-read</code> flag are:</p>
<ul>
<li><code>*</code> - To allow all <code>FileSystemRead</code> operations.</li>
<li>Multiple paths can be allowed using multiple <code>--allow-fs-read</code> flags.
Example <code>--allow-fs-read=/folder1/ --allow-fs-read=/folder1/</code></li>
</ul>
<p>Examples can be found in the <a href="permissions.html#file-system-permissions">File System Permissions</a> documentation.</p>
<p>The initializer module also needs to be allowed. Consider the following example:</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --permission index.js</span>
Error: Access to this API has been restricted
at node:internal/main/run_main_module:23:47 {
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemRead',
resource: '/Users/rafaelgss/repos/os/node/index.js'
}</code> <button class="copy-button">copy</button></pre>
<p>The process needs to have access to the <code>index.js</code> module:</p>
<pre><code class="language-bash">node --permission --allow-fs-read=/path/to/index.js index.js</code> <button class="copy-button">copy</button></pre>
<h4><code>--allow-fs-write</code><span><a class="mark" href="#--allow-fs-write" id="--allow-fs-write">#</a></span><a aria-hidden="true" class="legacy" id="cli_allow_fs_write"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.13.0</td>
<td><p>Permission Model and --allow-fs flags are stable.</p></td></tr>
<tr><td>v20.7.0</td>
<td><p>Paths delimited by comma (<code>,</code>) are no longer allowed.</p></td></tr>
<tr><td>v20.0.0</td>
<td><p><span>Added in: v20.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable.</div><p></p>
<p>This flag configures file system write permissions using
the <a href="permissions.html#permission-model">Permission Model</a>.</p>
<p>The valid arguments for the <code>--allow-fs-write</code> flag are:</p>
<ul>
<li><code>*</code> - To allow all <code>FileSystemWrite</code> operations.</li>
<li>Multiple paths can be allowed using multiple <code>--allow-fs-write</code> flags.
Example <code>--allow-fs-write=/folder1/ --allow-fs-write=/folder1/</code></li>
</ul>
<p>Paths delimited by comma (<code>,</code>) are no longer allowed.
When passing a single flag with a comma a warning will be displayed.</p>
<p>Examples can be found in the <a href="permissions.html#file-system-permissions">File System Permissions</a> documentation.</p>
<h4><code>--allow-wasi</code><span><a class="mark" href="#--allow-wasi" id="--allow-wasi">#</a></span><a aria-hidden="true" class="legacy" id="cli_allow_wasi"></a></h4>
<div class="api_metadata">
<span>Added in: v22.3.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active development</div><p></p>
<p>When using the <a href="permissions.html#permission-model">Permission Model</a>, the process will not be capable of creating
any WASI instances by default.
For security reasons, the call will throw an <code>ERR_ACCESS_DENIED</code> unless the
user explicitly passes the flag <code>--allow-wasi</code> in the main Node.js process.</p>
<p>Example:</p>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { <span class="hljs-variable constant_">WASI</span> } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:wasi'</span>);
<span class="hljs-comment">// Attempt to bypass the permission</span>
<span class="hljs-keyword">new</span> <span class="hljs-title function_">WASI</span>({
<span class="hljs-attr">version</span>: <span class="hljs-string">'preview1'</span>,
<span class="hljs-comment">// Attempt to mount the whole filesystem</span>
<span class="hljs-attr">preopens</span>: {
<span class="hljs-string">'/'</span>: <span class="hljs-string">'/'</span>,
},
});</code> <button class="copy-button">copy</button></pre>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --permission --allow-fs-read=* index.js</span>
Error: Access to this API has been restricted
at node:internal/main/run_main_module:30:49 {
code: 'ERR_ACCESS_DENIED',
permission: 'WASI',
}</code> <button class="copy-button">copy</button></pre>
<h4><code>--allow-worker</code><span><a class="mark" href="#--allow-worker" id="--allow-worker">#</a></span><a aria-hidden="true" class="legacy" id="cli_allow_worker"></a></h4>
<div class="api_metadata">
<span>Added in: v20.0.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active development</div><p></p>
<p>When using the <a href="permissions.html#permission-model">Permission Model</a>, the process will not be able to create any
worker threads by default.
For security reasons, the call will throw an <code>ERR_ACCESS_DENIED</code> unless the
user explicitly pass the flag <code>--allow-worker</code> in the main Node.js process.</p>
<p>Example:</p>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { <span class="hljs-title class_">Worker</span> } = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:worker_threads'</span>);
<span class="hljs-comment">// Attempt to bypass the permission</span>
<span class="hljs-keyword">new</span> <span class="hljs-title class_">Worker</span>(__filename);</code> <button class="copy-button">copy</button></pre>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --permission --allow-fs-read=* index.js</span>
Error: Access to this API has been restricted
at node:internal/main/run_main_module:17:47 {
code: 'ERR_ACCESS_DENIED',
permission: 'WorkerThreads'
}</code> <button class="copy-button">copy</button></pre>
<h4><code>--build-snapshot</code><span><a class="mark" href="#--build-snapshot" id="--build-snapshot">#</a></span><a aria-hidden="true" class="legacy" id="cli_build_snapshot"></a></h4>
<div class="api_metadata">
<span>Added in: v18.8.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Generates a snapshot blob when the process exits and writes it to
disk, which can be loaded later with <code>--snapshot-blob</code>.</p>
<p>When building the snapshot, if <code>--snapshot-blob</code> is not specified,
the generated blob will be written, by default, to <code>snapshot.blob</code>
in the current working directory. Otherwise it will be written to
the path specified by <code>--snapshot-blob</code>.</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">"globalThis.foo = 'I am from the snapshot'"</span> > snapshot.js</span>
<span class="hljs-meta prompt_">
# </span><span class="language-bash">Run snapshot.js to initialize the application and snapshot the</span>
<span class="hljs-meta prompt_"># </span><span class="language-bash">state of it into snapshot.blob.</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">node --snapshot-blob snapshot.blob --build-snapshot snapshot.js</span>
<span class="hljs-meta prompt_">
$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">"console.log(globalThis.foo)"</span> > index.js</span>
<span class="hljs-meta prompt_">
# </span><span class="language-bash">Load the generated snapshot and start the application from index.js.</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">node --snapshot-blob snapshot.blob index.js</span>
I am from the snapshot</code> <button class="copy-button">copy</button></pre>
<p>The <a href="v8.html#startup-snapshot-api"><code>v8.startupSnapshot</code> API</a> can be used to specify an entry point at
snapshot building time, thus avoiding the need of an additional entry
script at deserialization time:</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">"require('v8').startupSnapshot.setDeserializeMainFunction(() => console.log('I am from the snapshot'))"</span> > snapshot.js</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">node --snapshot-blob snapshot.blob --build-snapshot snapshot.js</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">node --snapshot-blob snapshot.blob</span>
I am from the snapshot</code> <button class="copy-button">copy</button></pre>
<p>For more information, check out the <a href="v8.html#startup-snapshot-api"><code>v8.startupSnapshot</code> API</a> documentation.</p>
<p>Currently the support for run-time snapshot is experimental in that:</p>
<ol>
<li>User-land modules are not yet supported in the snapshot, so only
one single file can be snapshotted. Users can bundle their applications
into a single script with their bundler of choice before building
a snapshot, however.</li>
<li>Only a subset of the built-in modules work in the snapshot, though the
Node.js core test suite checks that a few fairly complex applications
can be snapshotted. Support for more modules are being added. If any
crashes or buggy behaviors occur when building a snapshot, please file
a report in the <a href="https://github.com/nodejs/node/issues">Node.js issue tracker</a> and link to it in the
<a href="https://github.com/nodejs/node/issues/44014">tracking issue for user-land snapshots</a>.</li>
</ol>
<h4><code>--build-snapshot-config</code><span><a class="mark" href="#--build-snapshot-config" id="--build-snapshot-config">#</a></span><a aria-hidden="true" class="legacy" id="cli_build_snapshot_config"></a></h4>
<div class="api_metadata">
<span>Added in: v21.6.0, v20.12.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Specifies the path to a JSON configuration file which configures snapshot
creation behavior.</p>
<p>The following options are currently supported:</p>
<ul>
<li><code>builder</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a> Required. Provides the name to the script that is executed
before building the snapshot, as if <a href="#--build-snapshot"><code>--build-snapshot</code></a> had been passed
with <code>builder</code> as the main script name.</li>
<li><code>withoutCodeCache</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type"><boolean></a> Optional. Including the code cache reduces the
time spent on compiling functions included in the snapshot at the expense
of a bigger snapshot size and potentially breaking portability of the
snapshot.</li>
</ul>
<p>When using this flag, additional script files provided on the command line will
not be executed and instead be interpreted as regular command line arguments.</p>
<h4><code>-c</code>, <code>--check</code><span><a class="mark" href="#-c---check" id="-c---check">#</a></span><a aria-hidden="true" class="legacy" id="cli_c_check"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v10.0.0</td>
<td><p>The <code>--require</code> option is now supported when checking a file.</p></td></tr>
<tr><td>v5.0.0, v4.2.0</td>
<td><p><span>Added in: v5.0.0, v4.2.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Syntax check the script without executing.</p>
<h4><code>--completion-bash</code><span><a class="mark" href="#--completion-bash" id="--completion-bash">#</a></span><a aria-hidden="true" class="legacy" id="cli_completion_bash"></a></h4>
<div class="api_metadata">
<span>Added in: v10.12.0</span>
</div>
<p>Print source-able bash completion script for Node.js.</p>
<pre><code class="language-bash">node --completion-bash > node_bash_completion
<span class="hljs-built_in">source</span> node_bash_completion</code> <button class="copy-button">copy</button></pre>
<h4><code>-C condition</code>, <code>--conditions=condition</code><span><a class="mark" href="#-c-condition---conditionscondition" id="-c-condition---conditionscondition">#</a></span><a aria-hidden="true" class="legacy" id="cli_c_condition_conditions_condition"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.9.0</td>
<td><p>The flag is no longer experimental.</p></td></tr>
<tr><td>v14.9.0, v12.19.0</td>
<td><p><span>Added in: v14.9.0, v12.19.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Provide custom <a href="packages.html#conditional-exports">conditional exports</a> resolution conditions.</p>
<p>Any number of custom string condition names are permitted.</p>
<p>The default Node.js conditions of <code>"node"</code>, <code>"default"</code>, <code>"import"</code>, and
<code>"require"</code> will always apply as defined.</p>
<p>For example, to run a module with "development" resolutions:</p>
<pre><code class="language-bash">node -C development app.js</code> <button class="copy-button">copy</button></pre>
<h4><code>--cpu-prof</code><span><a class="mark" href="#--cpu-prof" id="--cpu-prof">#</a></span><a aria-hidden="true" class="legacy" id="cli_cpu_prof"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.4.0</td>
<td><p>The <code>--cpu-prof</code> flags are now stable.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p><span>Added in: v12.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Starts the V8 CPU profiler on start up, and writes the CPU profile to disk
before exit.</p>
<p>If <code>--cpu-prof-dir</code> is not specified, the generated profile is placed
in the current working directory.</p>
<p>If <code>--cpu-prof-name</code> is not specified, the generated profile is
named <code>CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile</code>.</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --cpu-prof index.js</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">ls</span> *.cpuprofile</span>
CPU.20190409.202950.15293.0.0.cpuprofile</code> <button class="copy-button">copy</button></pre>
<h4><code>--cpu-prof-dir</code><span><a class="mark" href="#--cpu-prof-dir" id="--cpu-prof-dir">#</a></span><a aria-hidden="true" class="legacy" id="cli_cpu_prof_dir"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.4.0</td>
<td><p>The <code>--cpu-prof</code> flags are now stable.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p><span>Added in: v12.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Specify the directory where the CPU profiles generated by <code>--cpu-prof</code> will
be placed.</p>
<p>The default value is controlled by the
<a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir</code></a> command-line option.</p>
<h4><code>--cpu-prof-interval</code><span><a class="mark" href="#--cpu-prof-interval" id="--cpu-prof-interval">#</a></span><a aria-hidden="true" class="legacy" id="cli_cpu_prof_interval"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.4.0</td>
<td><p>The <code>--cpu-prof</code> flags are now stable.</p></td></tr>
<tr><td>v12.2.0</td>
<td><p><span>Added in: v12.2.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Specify the sampling interval in microseconds for the CPU profiles generated
by <code>--cpu-prof</code>. The default is 1000 microseconds.</p>
<h4><code>--cpu-prof-name</code><span><a class="mark" href="#--cpu-prof-name" id="--cpu-prof-name">#</a></span><a aria-hidden="true" class="legacy" id="cli_cpu_prof_name"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.4.0</td>
<td><p>The <code>--cpu-prof</code> flags are now stable.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p><span>Added in: v12.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Specify the file name of the CPU profile generated by <code>--cpu-prof</code>.</p>
<h4><code>--diagnostic-dir=directory</code><span><a class="mark" href="#--diagnostic-dirdirectory" id="--diagnostic-dirdirectory">#</a></span><a aria-hidden="true" class="legacy" id="cli_diagnostic_dir_directory"></a></h4>
<p>Set the directory to which all diagnostic output files are written.
Defaults to current working directory.</p>
<p>Affects the default output directory of:</p>
<ul>
<li><a href="#--cpu-prof-dir"><code>--cpu-prof-dir</code></a></li>
<li><a href="#--heap-prof-dir"><code>--heap-prof-dir</code></a></li>
<li><a href="#--redirect-warningsfile"><code>--redirect-warnings</code></a></li>
</ul>
<h4><code>--disable-proto=mode</code><span><a class="mark" href="#--disable-protomode" id="--disable-protomode">#</a></span><a aria-hidden="true" class="legacy" id="cli_disable_proto_mode"></a></h4>
<div class="api_metadata">
<span>Added in: v13.12.0, v12.17.0</span>
</div>
<p>Disable the <code>Object.prototype.__proto__</code> property. If <code>mode</code> is <code>delete</code>, the
property is removed entirely. If <code>mode</code> is <code>throw</code>, accesses to the
property throw an exception with the code <code>ERR_PROTO_ACCESS</code>.</p>
<h4><code>--disable-sigusr1</code><span><a class="mark" href="#--disable-sigusr1" id="--disable-sigusr1">#</a></span><a aria-hidden="true" class="legacy" id="cli_disable_sigusr1"></a></h4>
<div class="api_metadata">
<span>Added in: v22.14.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.2 - Release candidate</div><p></p>
<p>Disable the ability of starting a debugging session by sending a
<code>SIGUSR1</code> signal to the process.</p>
<h4><code>--disable-warning=code-or-type</code><span><a class="mark" href="#--disable-warningcode-or-type" id="--disable-warningcode-or-type">#</a></span><a aria-hidden="true" class="legacy" id="cli_disable_warning_code_or_type"></a></h4>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active development</div><p></p>
<div class="api_metadata">
<span>Added in: v21.3.0, v20.11.0</span>
</div>
<p>Disable specific process warnings by <code>code</code> or <code>type</code>.</p>
<p>Warnings emitted from <a href="process.html#processemitwarningwarning-options"><code>process.emitWarning()</code></a> may contain a
<code>code</code> and a <code>type</code>. This option will not-emit warnings that have a matching
<code>code</code> or <code>type</code>.</p>
<p>List of <a href="deprecations.html#list-of-deprecated-apis">deprecation warnings</a>.</p>
<p>The Node.js core warning types are: <code>DeprecationWarning</code> and
<code>ExperimentalWarning</code></p>
<p>For example, the following script will not emit
<a href="deprecations.html#dep0025-requirenodesys">DEP0025 <code>require('node:sys')</code></a> when executed with
<code>node --disable-warning=DEP0025</code>:</p>
<pre class="with-32-chars"><input class="js-flavor-toggle" type="checkbox" checked aria-label="Show modern ES modules syntax"><code class="language-js mjs"><span class="hljs-keyword">import</span> sys <span class="hljs-keyword">from</span> <span class="hljs-string">'node:sys'</span>;</code><code class="language-js cjs"><span class="hljs-keyword">const</span> sys = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:sys'</span>);</code><button class="copy-button">copy</button></pre>
<p>For example, the following script will emit the
<a href="deprecations.html#dep0025-requirenodesys">DEP0025 <code>require('node:sys')</code></a>, but not any Experimental
Warnings (such as
<a href="vm.html#vmmeasurememoryoptions">ExperimentalWarning: <code>vm.measureMemory</code> is an experimental feature</a>
in <=v21) when executed with <code>node --disable-warning=ExperimentalWarning</code>:</p>
<pre class="with-32-chars"><input class="js-flavor-toggle" type="checkbox" checked aria-label="Show modern ES modules syntax"><code class="language-js mjs"><span class="hljs-keyword">import</span> sys <span class="hljs-keyword">from</span> <span class="hljs-string">'node:sys'</span>;
<span class="hljs-keyword">import</span> vm <span class="hljs-keyword">from</span> <span class="hljs-string">'node:vm'</span>;
vm.<span class="hljs-title function_">measureMemory</span>();</code><code class="language-js cjs"><span class="hljs-keyword">const</span> sys = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:sys'</span>);
<span class="hljs-keyword">const</span> vm = <span class="hljs-built_in">require</span>(<span class="hljs-string">'node:vm'</span>);
vm.<span class="hljs-title function_">measureMemory</span>();</code><button class="copy-button">copy</button></pre>
<h4><code>--disable-wasm-trap-handler</code><span><a class="mark" href="#--disable-wasm-trap-handler" id="--disable-wasm-trap-handler">#</a></span><a aria-hidden="true" class="legacy" id="cli_disable_wasm_trap_handler"></a></h4>
<div class="api_metadata">
<span>Added in: v22.2.0</span>
</div>
<p>By default, Node.js enables trap-handler-based WebAssembly bound
checks. As a result, V8 does not need to insert inline bound checks
int the code compiled from WebAssembly which may speedup WebAssembly
execution significantly, but this optimization requires allocating
a big virtual memory cage (currently 10GB). If the Node.js process
does not have access to a large enough virtual memory address space
due to system configurations or hardware limitations, users won't
be able to run any WebAssembly that involves allocation in this
virtual memory cage and will see an out-of-memory error.</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">ulimit</span> -v 5000000</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">node -p <span class="hljs-string">"new WebAssembly.Memory({ initial: 10, maximum: 100 });"</span></span>
[eval]:1
new WebAssembly.Memory({ initial: 10, maximum: 100 });
^
RangeError: WebAssembly.Memory(): could not allocate memory
at [eval]:1:1
at runScriptInThisContext (node:internal/vm:209:10)
at node:internal/process/execution:118:14
at [eval]-wrapper:6:24
at runScript (node:internal/process/execution:101:62)
at evalScript (node:internal/process/execution:136:3)
at node:internal/main/eval_string:49:3
</code> <button class="copy-button">copy</button></pre>
<p><code>--disable-wasm-trap-handler</code> disables this optimization so that
users can at least run WebAssembly (with less optimal performance)
when the virtual memory address space available to their Node.js
process is lower than what the V8 WebAssembly memory cage needs.</p>
<h4><code>--disallow-code-generation-from-strings</code><span><a class="mark" href="#--disallow-code-generation-from-strings" id="--disallow-code-generation-from-strings">#</a></span><a aria-hidden="true" class="legacy" id="cli_disallow_code_generation_from_strings"></a></h4>
<div class="api_metadata">
<span>Added in: v9.8.0</span>
</div>
<p>Make built-in language features like <code>eval</code> and <code>new Function</code> that generate
code from strings throw an exception instead. This does not affect the Node.js
<code>node:vm</code> module.</p>
<h4><code>--dns-result-order=order</code><span><a class="mark" href="#--dns-result-orderorder" id="--dns-result-orderorder">#</a></span><a aria-hidden="true" class="legacy" id="cli_dns_result_order_order"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.1.0</td>
<td><p>The <code>ipv6first</code> is supported now.</p></td></tr>
<tr><td>v17.0.0</td>
<td><p>Changed default value to <code>verbatim</code>.</p></td></tr>
<tr><td>v16.4.0, v14.18.0</td>
<td><p><span>Added in: v16.4.0, v14.18.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Set the default value of <code>order</code> in <a href="dns.html#dnslookuphostname-options-callback"><code>dns.lookup()</code></a> and
<a href="dns.html#dnspromiseslookuphostname-options"><code>dnsPromises.lookup()</code></a>. The value could be:</p>
<ul>
<li><code>ipv4first</code>: sets default <code>order</code> to <code>ipv4first</code>.</li>
<li><code>ipv6first</code>: sets default <code>order</code> to <code>ipv6first</code>.</li>
<li><code>verbatim</code>: sets default <code>order</code> to <code>verbatim</code>.</li>
</ul>
<p>The default is <code>verbatim</code> and <a href="dns.html#dnssetdefaultresultorderorder"><code>dns.setDefaultResultOrder()</code></a> have higher
priority than <code>--dns-result-order</code>.</p>
<h4><code>--enable-fips</code><span><a class="mark" href="#--enable-fips" id="--enable-fips">#</a></span><a aria-hidden="true" class="legacy" id="cli_enable_fips"></a></h4>
<div class="api_metadata">
<span>Added in: v6.0.0</span>
</div>
<p>Enable FIPS-compliant crypto at startup. (Requires Node.js to be built
against FIPS-compatible OpenSSL.)</p>
<h4><code>--enable-network-family-autoselection</code><span><a class="mark" href="#--enable-network-family-autoselection" id="--enable-network-family-autoselection">#</a></span><a aria-hidden="true" class="legacy" id="cli_enable_network_family_autoselection"></a></h4>
<div class="api_metadata">
<span>Added in: v18.18.0</span>
</div>
<p>Enables the family autoselection algorithm unless connection options explicitly
disables it.</p>
<h4><code>--enable-source-maps</code><span><a class="mark" href="#--enable-source-maps" id="--enable-source-maps">#</a></span><a aria-hidden="true" class="legacy" id="cli_enable_source_maps"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v15.11.0, v14.18.0</td>
<td><p>This API is no longer experimental.</p></td></tr>
<tr><td>v12.12.0</td>
<td><p><span>Added in: v12.12.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Enable <a href="https://sourcemaps.info/spec.html">Source Map v3</a> support for stack traces.</p>
<p>When using a transpiler, such as TypeScript, stack traces thrown by an
application reference the transpiled code, not the original source position.
<code>--enable-source-maps</code> enables caching of Source Maps and makes a best
effort to report stack traces relative to the original source file.</p>
<p>Overriding <code>Error.prepareStackTrace</code> may prevent <code>--enable-source-maps</code> from
modifying the stack trace. Call and return the results of the original
<code>Error.prepareStackTrace</code> in the overriding function to modify the stack trace
with source maps.</p>
<pre><code class="language-js"><span class="hljs-keyword">const</span> originalPrepareStackTrace = <span class="hljs-title class_">Error</span>.<span class="hljs-property">prepareStackTrace</span>;
<span class="hljs-title class_">Error</span>.<span class="hljs-property">prepareStackTrace</span> = <span class="hljs-function">(<span class="hljs-params">error, trace</span>) =></span> {
<span class="hljs-comment">// Modify error and trace and format stack trace with</span>
<span class="hljs-comment">// original Error.prepareStackTrace.</span>
<span class="hljs-keyword">return</span> <span class="hljs-title function_">originalPrepareStackTrace</span>(error, trace);
};</code> <button class="copy-button">copy</button></pre>
<p>Note, enabling source maps can introduce latency to your application
when <code>Error.stack</code> is accessed. If you access <code>Error.stack</code> frequently
in your application, take into account the performance implications
of <code>--enable-source-maps</code>.</p>
<h4><code>--entry-url</code><span><a class="mark" href="#--entry-url" id="--entry-url">#</a></span><a aria-hidden="true" class="legacy" id="cli_entry_url"></a></h4>
<div class="api_metadata">
<span>Added in: v22.10.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>When present, Node.js will interpret the entry point as a URL, rather than a
path.</p>
<p>Follows <a href="esm.html#modules-ecmascript-modules">ECMAScript module</a> resolution rules.</p>
<p>Any query parameter or hash in the URL will be accessible via <a href="esm.html#importmetaurl"><code>import.meta.url</code></a>.</p>
<pre><code class="language-bash">node --entry-url <span class="hljs-string">'file:///path/to/file.js?queryparams=work#and-hashes-too'</span>
node --entry-url --experimental-strip-types <span class="hljs-string">'file.ts?query#hash'</span>
node --entry-url <span class="hljs-string">'data:text/javascript,console.log("Hello")'</span></code> <button class="copy-button">copy</button></pre>
<h4><code>--env-file-if-exists=config</code><span><a class="mark" href="#--env-file-if-existsconfig" id="--env-file-if-existsconfig">#</a></span><a aria-hidden="true" class="legacy" id="cli_env_file_if_exists_config"></a></h4>
<div class="api_metadata">
<span>Added in: v22.9.0</span>
</div>
<p>Behavior is the same as <a href="#--env-fileconfig"><code>--env-file</code></a>, but an error is not thrown if the file
does not exist.</p>
<h4><code>--env-file=config</code><span><a class="mark" href="#--env-fileconfig" id="--env-fileconfig">#</a></span><a aria-hidden="true" class="legacy" id="cli_env_file_config"></a></h4>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active development</div><p></p>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v21.7.0, v20.12.0</td>
<td><p>Add support to multi-line values.</p></td></tr>
<tr><td>v20.6.0</td>
<td><p><span>Added in: v20.6.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Loads environment variables from a file relative to the current directory,
making them available to applications on <code>process.env</code>. The <a href="#environment-variables">environment
variables which configure Node.js</a>, such as <code>NODE_OPTIONS</code>,
are parsed and applied. If the same variable is defined in the environment and
in the file, the value from the environment takes precedence.</p>
<p>You can pass multiple <code>--env-file</code> arguments. Subsequent files override
pre-existing variables defined in previous files.</p>
<p>An error is thrown if the file does not exist.</p>
<pre><code class="language-bash">node --env-file=.<span class="hljs-built_in">env</span> --env-file=.development.env index.js</code> <button class="copy-button">copy</button></pre>
<p>The format of the file should be one line per key-value pair of environment
variable name and value separated by <code>=</code>:</p>
<pre><code class="language-text">PORT=3000</code> <button class="copy-button">copy</button></pre>
<p>Any text after a <code>#</code> is treated as a comment:</p>
<pre><code class="language-text"># This is a comment
PORT=3000 # This is also a comment</code> <button class="copy-button">copy</button></pre>
<p>Values can start and end with the following quotes: <code>`</code>, <code>"</code> or <code>'</code>.
They are omitted from the values.</p>
<pre><code class="language-text">USERNAME="nodejs" # will result in `nodejs` as the value.</code> <button class="copy-button">copy</button></pre>
<p>Multi-line values are supported:</p>
<pre><code class="language-text">MULTI_LINE="THIS IS
A MULTILINE"
# will result in `THIS IS\nA MULTILINE` as the value.</code> <button class="copy-button">copy</button></pre>
<p>Export keyword before a key is ignored:</p>
<pre><code class="language-text">export USERNAME="nodejs" # will result in `nodejs` as the value.</code> <button class="copy-button">copy</button></pre>
<p>If you want to load environment variables from a file that may not exist, you
can use the <a href="#--env-file-if-existsconfig"><code>--env-file-if-exists</code></a> flag instead.</p>
<h4><code>-e</code>, <code>--eval "script"</code><span><a class="mark" href="#-e---eval-script" id="-e---eval-script">#</a></span><a aria-hidden="true" class="legacy" id="cli_e_eval_script"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.6.0</td>
<td><p>Eval now supports experimental type-stripping.</p></td></tr>
<tr><td>v5.11.0</td>
<td><p>Built-in libraries are now available as predefined variables.</p></td></tr>
<tr><td>v0.5.2</td>
<td><p><span>Added in: v0.5.2</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Evaluate the following argument as JavaScript. The modules which are
predefined in the REPL can also be used in <code>script</code>.</p>
<p>On Windows, using <code>cmd.exe</code> a single quote will not work correctly because it
only recognizes double <code>"</code> for quoting. In Powershell or Git bash, both <code>'</code>
and <code>"</code> are usable.</p>
<p>It is possible to run code containing inline types by passing
<a href="#--experimental-strip-types"><code>--experimental-strip-types</code></a>.</p>
<h4><code>--experimental-async-context-frame</code><span><a class="mark" href="#--experimental-async-context-frame" id="--experimental-async-context-frame">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_async_context_frame"></a></h4>
<div class="api_metadata">
<span>Added in: v22.7.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Enables the use of <a href="async_context.html#class-asynclocalstorage"><code>AsyncLocalStorage</code></a> backed by <code>AsyncContextFrame</code> rather
than the default implementation which relies on async_hooks. This new model is
implemented very differently and so could have differences in how context data
flows within the application. As such, it is presently recommended to be sure
your application behaviour is unaffected by this change before using it in
production.</p>
<h4><code>--experimental-default-type=type</code><span><a class="mark" href="#--experimental-default-typetype" id="--experimental-default-typetype">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_default_type_type"></a></h4>
<div class="api_metadata">
<span>Added in: v21.0.0, v20.10.0, v18.19.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.0 - Early development</div><p></p>
<p>Define which module system, <code>module</code> or <code>commonjs</code>, to use for the following:</p>
<ul>
<li>
<p>String input provided via <code>--eval</code> or STDIN, if <code>--input-type</code> is unspecified.</p>
</li>
<li>
<p>Files ending in <code>.js</code> or with no extension, if there is no <code>package.json</code> file
present in the same folder or any parent folder.</p>
</li>
<li>
<p>Files ending in <code>.js</code> or with no extension, if the nearest parent
<code>package.json</code> field lacks a <code>"type"</code> field; unless the <code>package.json</code> folder
or any parent folder is inside a <code>node_modules</code> folder.</p>
</li>
</ul>
<p>In other words, <code>--experimental-default-type=module</code> flips all the places where
Node.js currently defaults to CommonJS to instead default to ECMAScript modules,
with the exception of folders and subfolders below <code>node_modules</code>, for backward
compatibility.</p>
<p>Under <code>--experimental-default-type=module</code> and <code>--experimental-wasm-modules</code>,
files with no extension will be treated as WebAssembly if they begin with the
WebAssembly magic number (<code>\0asm</code>); otherwise they will be treated as ES module
JavaScript.</p>
<h4><code>--experimental-eventsource</code><span><a class="mark" href="#--experimental-eventsource" id="--experimental-eventsource">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_eventsource"></a></h4>
<div class="api_metadata">
<span>Added in: v22.3.0</span>
</div>
<p>Enable exposition of <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events">EventSource Web API</a> on the global scope.</p>
<h4><code>--experimental-import-meta-resolve</code><span><a class="mark" href="#--experimental-import-meta-resolve" id="--experimental-import-meta-resolve">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_import_meta_resolve"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.6.0, v18.19.0</td>
<td><p>synchronous import.meta.resolve made available by default, with the flag retained for enabling the experimental second argument as previously supported.</p></td></tr>
<tr><td>v13.9.0, v12.16.2</td>
<td><p><span>Added in: v13.9.0, v12.16.2</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Enable experimental <code>import.meta.resolve()</code> parent URL support, which allows
passing a second <code>parentURL</code> argument for contextual resolution.</p>
<p>Previously gated the entire <code>import.meta.resolve</code> feature.</p>
<h4><code>--experimental-loader=module</code><span><a class="mark" href="#--experimental-loadermodule" id="--experimental-loadermodule">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_loader_module"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.13.1</td>
<td><p>Using this feature with the permission model enabled requires passing <code>--allow-worker</code>.</p></td></tr>
<tr><td>v12.11.1</td>
<td><p>This flag was renamed from <code>--loader</code> to <code>--experimental-loader</code>.</p></td></tr>
<tr><td>v8.8.0</td>
<td><p><span>Added in: v8.8.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<blockquote>
<p>This flag is discouraged and may be removed in a future version of Node.js.
Please use
<a href="module.html#enabling"><code>--import</code> with <code>register()</code></a> instead.</p>
</blockquote>
<p>Specify the <code>module</code> containing exported <a href="module.html#customization-hooks">module customization hooks</a>.
<code>module</code> may be any string accepted as an <a href="esm.html#import-specifiers"><code>import</code> specifier</a>.</p>
<p>This feature requires <code>--allow-worker</code> if used with the <a href="permissions.html#permission-model">Permission Model</a>.</p>
<h4><code>--experimental-network-inspection</code><span><a class="mark" href="#--experimental-network-inspection" id="--experimental-network-inspection">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_network_inspection"></a></h4>
<div class="api_metadata">
<span>Added in: v22.6.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Enable experimental support for the network inspection with Chrome DevTools.</p>
<h4><code>--experimental-print-required-tla</code><span><a class="mark" href="#--experimental-print-required-tla" id="--experimental-print-required-tla">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_print_required_tla"></a></h4>
<div class="api_metadata">
<span>Added in: v22.0.0</span>
</div>
<p>If the ES module being <code>require()</code>'d contains top-level <code>await</code>, this flag
allows Node.js to evaluate the module, try to locate the
top-level awaits, and print their location to help users find them.</p>
<h4><code>--experimental-require-module</code><span><a class="mark" href="#--experimental-require-module" id="--experimental-require-module">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_require_module"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.12.0</td>
<td><p>This is now true by default.</p></td></tr>
<tr><td>v22.0.0</td>
<td><p><span>Added in: v22.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active Development</div><p></p>
<p>Supports loading a synchronous ES module graph in <code>require()</code>.</p>
<p>See <a href="modules.html#loading-ecmascript-modules-using-require">Loading ECMAScript modules using <code>require()</code></a>.</p>
<h4><code>--experimental-sea-config</code><span><a class="mark" href="#--experimental-sea-config" id="--experimental-sea-config">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_sea_config"></a></h4>
<div class="api_metadata">
<span>Added in: v20.0.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Use this flag to generate a blob that can be injected into the Node.js
binary to produce a <a href="single-executable-applications.html">single executable application</a>. See the documentation
about <a href="single-executable-applications.html#generating-single-executable-preparation-blobs">this configuration</a> for details.</p>
<h4><code>--experimental-shadow-realm</code><span><a class="mark" href="#--experimental-shadow-realm" id="--experimental-shadow-realm">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_shadow_realm"></a></h4>
<div class="api_metadata">
<span>Added in: v19.0.0, v18.13.0</span>
</div>
<p>Use this flag to enable <a href="https://github.com/tc39/proposal-shadowrealm">ShadowRealm</a> support.</p>
<h4><code>--experimental-strip-types</code><span><a class="mark" href="#--experimental-strip-types" id="--experimental-strip-types">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_strip_types"></a></h4>
<div class="api_metadata">
<span>Added in: v22.6.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active development</div><p></p>
<p>Enable experimental type-stripping for TypeScript files.
For more information, see the <a href="typescript.html#type-stripping">TypeScript type-stripping</a> documentation.</p>
<h4><code>--experimental-test-coverage</code><span><a class="mark" href="#--experimental-test-coverage" id="--experimental-test-coverage">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_test_coverage"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.1.0, v18.17.0</td>
<td><p>This option can be used with <code>--test</code>.</p></td></tr>
<tr><td>v19.7.0, v18.15.0</td>
<td><p><span>Added in: v19.7.0, v18.15.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>When used in conjunction with the <code>node:test</code> module, a code coverage report is
generated as part of the test runner output. If no tests are run, a coverage
report is not generated. See the documentation on
<a href="test.html#collecting-code-coverage">collecting code coverage from tests</a> for more details.</p>
<h4><code>--experimental-test-isolation=mode</code><span><a class="mark" href="#--experimental-test-isolationmode" id="--experimental-test-isolationmode">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_test_isolation_mode"></a></h4>
<div class="api_metadata">
<span>Added in: v22.8.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.0 - Early development</div><p></p>
<p>Configures the type of test isolation used in the test runner. When <code>mode</code> is
<code>'process'</code>, each test file is run in a separate child process. When <code>mode</code> is
<code>'none'</code>, all test files run in the same process as the test runner. The default
isolation mode is <code>'process'</code>. This flag is ignored if the <code>--test</code> flag is not
present. See the <a href="test.html#test-runner-execution-model">test runner execution model</a> section for more information.</p>
<h4><code>--experimental-test-module-mocks</code><span><a class="mark" href="#--experimental-test-module-mocks" id="--experimental-test-module-mocks">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_test_module_mocks"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.13.1</td>
<td><p>Using this feature with the permission model enabled requires passing <code>--allow-worker</code>.</p></td></tr>
<tr><td>v22.3.0</td>
<td><p><span>Added in: v22.3.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.0 - Early development</div><p></p>
<p>Enable module mocking in the test runner.</p>
<p>This feature requires <code>--allow-worker</code> if used with the <a href="permissions.html#permission-model">Permission Model</a>.</p>
<h4><code>--experimental-transform-types</code><span><a class="mark" href="#--experimental-transform-types" id="--experimental-transform-types">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_transform_types"></a></h4>
<div class="api_metadata">
<span>Added in: v22.7.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active development</div><p></p>
<p>Enables the transformation of TypeScript-only syntax into JavaScript code.
Implies <code>--experimental-strip-types</code> and <code>--enable-source-maps</code>.</p>
<h4><code>--experimental-vm-modules</code><span><a class="mark" href="#--experimental-vm-modules" id="--experimental-vm-modules">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_vm_modules"></a></h4>
<div class="api_metadata">
<span>Added in: v9.6.0</span>
</div>
<p>Enable experimental ES Module support in the <code>node:vm</code> module.</p>
<h4><code>--experimental-wasi-unstable-preview1</code><span><a class="mark" href="#--experimental-wasi-unstable-preview1" id="--experimental-wasi-unstable-preview1">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_wasi_unstable_preview1"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.0.0, v18.17.0</td>
<td><p>This option is no longer required as WASI is enabled by default, but can still be passed.</p></td></tr>
<tr><td>v13.6.0</td>
<td><p>changed from <code>--experimental-wasi-unstable-preview0</code> to <code>--experimental-wasi-unstable-preview1</code>.</p></td></tr>
<tr><td>v13.3.0, v12.16.0</td>
<td><p><span>Added in: v13.3.0, v12.16.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Enable experimental WebAssembly System Interface (WASI) support.</p>
<h4><code>--experimental-wasm-modules</code><span><a class="mark" href="#--experimental-wasm-modules" id="--experimental-wasm-modules">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_wasm_modules"></a></h4>
<div class="api_metadata">
<span>Added in: v12.3.0</span>
</div>
<p>Enable experimental WebAssembly module support.</p>
<h4><code>--experimental-webstorage</code><span><a class="mark" href="#--experimental-webstorage" id="--experimental-webstorage">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_webstorage"></a></h4>
<div class="api_metadata">
<span>Added in: v22.4.0</span>
</div>
<p>Enable experimental <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API"><code>Web Storage</code></a> support.</p>
<h4><code>--expose-gc</code><span><a class="mark" href="#--expose-gc" id="--expose-gc">#</a></span><a aria-hidden="true" class="legacy" id="cli_expose_gc"></a></h4>
<div class="api_metadata">
<span>Added in: v22.3.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental. This flag is inherited from V8 and is subject to
change upstream.</div><p></p>
<p>This flag will expose the gc extension from V8.</p>
<pre><code class="language-js"><span class="hljs-keyword">if</span> (globalThis.<span class="hljs-property">gc</span>) {
globalThis.<span class="hljs-title function_">gc</span>();
}</code> <button class="copy-button">copy</button></pre>
<h4><code>--force-context-aware</code><span><a class="mark" href="#--force-context-aware" id="--force-context-aware">#</a></span><a aria-hidden="true" class="legacy" id="cli_force_context_aware"></a></h4>
<div class="api_metadata">
<span>Added in: v12.12.0</span>
</div>
<p>Disable loading native addons that are not <a href="addons.html#context-aware-addons">context-aware</a>.</p>
<h4><code>--force-fips</code><span><a class="mark" href="#--force-fips" id="--force-fips">#</a></span><a aria-hidden="true" class="legacy" id="cli_force_fips"></a></h4>
<div class="api_metadata">
<span>Added in: v6.0.0</span>
</div>
<p>Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.)
(Same requirements as <code>--enable-fips</code>.)</p>
<h4><code>--force-node-api-uncaught-exceptions-policy</code><span><a class="mark" href="#--force-node-api-uncaught-exceptions-policy" id="--force-node-api-uncaught-exceptions-policy">#</a></span><a aria-hidden="true" class="legacy" id="cli_force_node_api_uncaught_exceptions_policy"></a></h4>
<div class="api_metadata">
<span>Added in: v18.3.0, v16.17.0</span>
</div>
<p>Enforces <code>uncaughtException</code> event on Node-API asynchronous callbacks.</p>
<p>To prevent from an existing add-on from crashing the process, this flag is not
enabled by default. In the future, this flag will be enabled by default to
enforce the correct behavior.</p>
<h4><code>--frozen-intrinsics</code><span><a class="mark" href="#--frozen-intrinsics" id="--frozen-intrinsics">#</a></span><a aria-hidden="true" class="legacy" id="cli_frozen_intrinsics"></a></h4>
<div class="api_metadata">
<span>Added in: v11.12.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Enable experimental frozen intrinsics like <code>Array</code> and <code>Object</code>.</p>
<p>Only the root context is supported. There is no guarantee that
<code>globalThis.Array</code> is indeed the default intrinsic reference. Code may break
under this flag.</p>
<p>To allow polyfills to be added,
<a href="#-r---require-module"><code>--require</code></a> and <a href="#--importmodule"><code>--import</code></a> both run before freezing intrinsics.</p>
<h4><code>--heap-prof</code><span><a class="mark" href="#--heap-prof" id="--heap-prof">#</a></span><a aria-hidden="true" class="legacy" id="cli_heap_prof"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.4.0</td>
<td><p>The <code>--heap-prof</code> flags are now stable.</p></td></tr>
<tr><td>v12.4.0</td>
<td><p><span>Added in: v12.4.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Starts the V8 heap profiler on start up, and writes the heap profile to disk
before exit.</p>
<p>If <code>--heap-prof-dir</code> is not specified, the generated profile is placed
in the current working directory.</p>
<p>If <code>--heap-prof-name</code> is not specified, the generated profile is
named <code>Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile</code>.</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --heap-prof index.js</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">ls</span> *.heapprofile</span>
Heap.20190409.202950.15293.0.001.heapprofile</code> <button class="copy-button">copy</button></pre>
<h4><code>--heap-prof-dir</code><span><a class="mark" href="#--heap-prof-dir" id="--heap-prof-dir">#</a></span><a aria-hidden="true" class="legacy" id="cli_heap_prof_dir"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.4.0</td>
<td><p>The <code>--heap-prof</code> flags are now stable.</p></td></tr>
<tr><td>v12.4.0</td>
<td><p><span>Added in: v12.4.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Specify the directory where the heap profiles generated by <code>--heap-prof</code> will
be placed.</p>
<p>The default value is controlled by the
<a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir</code></a> command-line option.</p>
<h4><code>--heap-prof-interval</code><span><a class="mark" href="#--heap-prof-interval" id="--heap-prof-interval">#</a></span><a aria-hidden="true" class="legacy" id="cli_heap_prof_interval"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.4.0</td>
<td><p>The <code>--heap-prof</code> flags are now stable.</p></td></tr>
<tr><td>v12.4.0</td>
<td><p><span>Added in: v12.4.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Specify the average sampling interval in bytes for the heap profiles generated
by <code>--heap-prof</code>. The default is 512 * 1024 bytes.</p>
<h4><code>--heap-prof-name</code><span><a class="mark" href="#--heap-prof-name" id="--heap-prof-name">#</a></span><a aria-hidden="true" class="legacy" id="cli_heap_prof_name"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.4.0</td>
<td><p>The <code>--heap-prof</code> flags are now stable.</p></td></tr>
<tr><td>v12.4.0</td>
<td><p><span>Added in: v12.4.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Specify the file name of the heap profile generated by <code>--heap-prof</code>.</p>
<h4><code>--heapsnapshot-near-heap-limit=max_count</code><span><a class="mark" href="#--heapsnapshot-near-heap-limitmax_count" id="--heapsnapshot-near-heap-limitmax_count">#</a></span><a aria-hidden="true" class="legacy" id="cli_heapsnapshot_near_heap_limit_max_count"></a></h4>
<div class="api_metadata">
<span>Added in: v15.1.0, v14.18.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Writes a V8 heap snapshot to disk when the V8 heap usage is approaching the
heap limit. <code>count</code> should be a non-negative integer (in which case
Node.js will write no more than <code>max_count</code> snapshots to disk).</p>
<p>When generating snapshots, garbage collection may be triggered and bring
the heap usage down. Therefore multiple snapshots may be written to disk
before the Node.js instance finally runs out of memory. These heap snapshots
can be compared to determine what objects are being allocated during the
time consecutive snapshots are taken. It's not guaranteed that Node.js will
write exactly <code>max_count</code> snapshots to disk, but it will try
its best to generate at least one and up to <code>max_count</code> snapshots before the
Node.js instance runs out of memory when <code>max_count</code> is greater than <code>0</code>.</p>
<p>Generating V8 snapshots takes time and memory (both memory managed by the
V8 heap and native memory outside the V8 heap). The bigger the heap is,
the more resources it needs. Node.js will adjust the V8 heap to accommodate
the additional V8 heap memory overhead, and try its best to avoid using up
all the memory available to the process. When the process uses
more memory than the system deems appropriate, the process may be terminated
abruptly by the system, depending on the system configuration.</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --max-old-space-size=100 --heapsnapshot-near-heap-limit=3 index.js</span>
Wrote snapshot to Heap.20200430.100036.49580.0.001.heapsnapshot
Wrote snapshot to Heap.20200430.100037.49580.0.002.heapsnapshot
Wrote snapshot to Heap.20200430.100038.49580.0.003.heapsnapshot
<--- Last few GCs --->
[49580:0x110000000] 4826 ms: Mark-sweep 130.6 (147.8) -> 130.5 (147.8) MB, 27.4 / 0.0 ms (average mu = 0.126, current mu = 0.034) allocation failure scavenge might not succeed
[49580:0x110000000] 4845 ms: Mark-sweep 130.6 (147.8) -> 130.6 (147.8) MB, 18.8 / 0.0 ms (average mu = 0.088, current mu = 0.031) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
....</code> <button class="copy-button">copy</button></pre>
<h4><code>--heapsnapshot-signal=signal</code><span><a class="mark" href="#--heapsnapshot-signalsignal" id="--heapsnapshot-signalsignal">#</a></span><a aria-hidden="true" class="legacy" id="cli_heapsnapshot_signal_signal"></a></h4>
<div class="api_metadata">
<span>Added in: v12.0.0</span>
</div>
<p>Enables a signal handler that causes the Node.js process to write a heap dump
when the specified signal is received. <code>signal</code> must be a valid signal name.
Disabled by default.</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --heapsnapshot-signal=SIGUSR2 index.js &</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">ps aux</span>
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
node 1 5.5 6.1 787252 247004 ? Ssl 16:43 0:02 node --heapsnapshot-signal=SIGUSR2 index.js
<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">kill</span> -USR2 1</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">ls</span></span>
Heap.20190718.133405.15554.0.001.heapsnapshot</code> <button class="copy-button">copy</button></pre>
<h4><code>-h</code>, <code>--help</code><span><a class="mark" href="#-h---help" id="-h---help">#</a></span><a aria-hidden="true" class="legacy" id="cli_h_help"></a></h4>
<div class="api_metadata">
<span>Added in: v0.1.3</span>
</div>
<p>Print node command-line options.
The output of this option is less detailed than this document.</p>
<h4><code>--icu-data-dir=file</code><span><a class="mark" href="#--icu-data-dirfile" id="--icu-data-dirfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_icu_data_dir_file"></a></h4>
<div class="api_metadata">
<span>Added in: v0.11.15</span>
</div>
<p>Specify ICU data load path. (Overrides <code>NODE_ICU_DATA</code>.)</p>
<h4><code>--import=module</code><span><a class="mark" href="#--importmodule" id="--importmodule">#</a></span><a aria-hidden="true" class="legacy" id="cli_import_module"></a></h4>
<div class="api_metadata">
<span>Added in: v19.0.0, v18.18.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Preload the specified module at startup. If the flag is provided several times,
each module will be executed sequentially in the order they appear, starting
with the ones provided in <a href="#node_optionsoptions"><code>NODE_OPTIONS</code></a>.</p>
<p>Follows <a href="esm.html#modules-ecmascript-modules">ECMAScript module</a> resolution rules.
Use <a href="#-r---require-module"><code>--require</code></a> to load a <a href="modules.html">CommonJS module</a>.
Modules preloaded with <code>--require</code> will run before modules preloaded with <code>--import</code>.</p>
<p>Modules are preloaded into the main thread as well as any worker threads,
forked processes, or clustered processes.</p>
<h4><code>--input-type=type</code><span><a class="mark" href="#--input-typetype" id="--input-typetype">#</a></span><a aria-hidden="true" class="legacy" id="cli_input_type_type"></a></h4>
<div class="api_metadata">
<span>Added in: v12.0.0</span>
</div>
<p>This configures Node.js to interpret <code>--eval</code> or <code>STDIN</code> input as CommonJS or
as an ES module. Valid values are <code>"commonjs"</code>, <code>"module"</code>, <code>"module-typescript"</code> and <code>"commonjs-typescript"</code>.
The <code>"-typescript"</code> values are available only in combination with the flag <code>--experimental-strip-types</code>.
The default is <code>"commonjs"</code> unless <a href="#--experimental-default-typetype"><code>--experimental-default-type=module</code></a> is used.
If <code>--experimental-strip-types</code> is enabled and <code>--input-type</code> is not provided,
Node.js will try to detect the syntax with the following steps:</p>
<ol>
<li>Run the input as CommonJS.</li>
<li>If step 1 fails, run the input as an ES module.</li>
<li>If step 2 fails with a SyntaxError, strip the types.</li>
<li>If step 3 fails with an error code <a href="errors.html#err_unsupported_typescript_syntax"><code>ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX</code></a>
or <a href="errors.html#err_invalid_typescript_syntax"><code>ERR_INVALID_TYPESCRIPT_SYNTAX</code></a>,
throw the error from step 2, including the TypeScript error in the message,
else run as CommonJS.</li>
<li>If step 4 fails, run the input as an ES module.</li>
</ol>
<p>To avoid the delay of multiple syntax detection passes, the <code>--input-type=type</code> flag can be used to specify
how the <code>--eval</code> input should be interpreted.</p>
<p>The REPL does not support this option. Usage of <code>--input-type=module</code> with
<a href="#-p---print-script"><code>--print</code></a> will throw an error, as <code>--print</code> does not support ES module
syntax.</p>
<h4><code>--insecure-http-parser</code><span><a class="mark" href="#--insecure-http-parser" id="--insecure-http-parser">#</a></span><a aria-hidden="true" class="legacy" id="cli_insecure_http_parser"></a></h4>
<div class="api_metadata">
<span>Added in: v13.4.0, v12.15.0, v10.19.0</span>
</div>
<p>Enable leniency flags on the HTTP parser. This may allow
interoperability with non-conformant HTTP implementations.</p>
<p>When enabled, the parser will accept the following:</p>
<ul>
<li>Invalid HTTP headers values.</li>
<li>Invalid HTTP versions.</li>
<li>Allow message containing both <code>Transfer-Encoding</code>
and <code>Content-Length</code> headers.</li>
<li>Allow extra data after message when <code>Connection: close</code> is present.</li>
<li>Allow extra transfer encodings after <code>chunked</code> has been provided.</li>
<li>Allow <code>\n</code> to be used as token separator instead of <code>\r\n</code>.</li>
<li>Allow <code>\r\n</code> not to be provided after a chunk.</li>
<li>Allow spaces to be present after a chunk size and before <code>\r\n</code>.</li>
</ul>
<p>All the above will expose your application to request smuggling
or poisoning attack. Avoid using this option.</p>
<h4><code>--inspect-brk[=[host:]port]</code><span><a class="mark" href="#--inspect-brkhostport" id="--inspect-brkhostport">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_brk_host_port"></a></h4>
<div class="api_metadata">
<span>Added in: v7.6.0</span>
</div>
<p>Activate inspector on <code>host:port</code> and break at start of user script.
Default <code>host:port</code> is <code>127.0.0.1:9229</code>. If port <code>0</code> is specified,
a random available port will be used.</p>
<p>See <a href="debugger.html#v8-inspector-integration-for-nodejs">V8 Inspector integration for Node.js</a> for further explanation on Node.js debugger.</p>
<h4><code>--inspect-port=[host:]port</code><span><a class="mark" href="#--inspect-porthostport" id="--inspect-porthostport">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_port_host_port"></a></h4>
<div class="api_metadata">
<span>Added in: v7.6.0</span>
</div>
<p>Set the <code>host:port</code> to be used when the inspector is activated.
Useful when activating the inspector by sending the <code>SIGUSR1</code> signal.
Except when <a href="#--disable-sigusr1"><code>--disable-sigusr1</code></a> is passed.</p>
<p>Default host is <code>127.0.0.1</code>. If port <code>0</code> is specified,
a random available port will be used.</p>
<p>See the <a href="#warning-binding-inspector-to-a-public-ipport-combination-is-insecure">security warning</a> below regarding the <code>host</code>
parameter usage.</p>
<h4><code>--inspect-publish-uid=stderr,http</code><span><a class="mark" href="#--inspect-publish-uidstderrhttp" id="--inspect-publish-uidstderrhttp">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_publish_uid_stderr_http"></a></h4>
<p>Specify ways of the inspector web socket url exposure.</p>
<p>By default inspector websocket url is available in stderr and under <code>/json/list</code>
endpoint on <code>http://host:port/json/list</code>.</p>
<h4><code>--inspect-wait[=[host:]port]</code><span><a class="mark" href="#--inspect-waithostport" id="--inspect-waithostport">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_wait_host_port"></a></h4>
<div class="api_metadata">
<span>Added in: v22.2.0</span>
</div>
<p>Activate inspector on <code>host:port</code> and wait for debugger to be attached.
Default <code>host:port</code> is <code>127.0.0.1:9229</code>. If port <code>0</code> is specified,
a random available port will be used.</p>
<p>See <a href="debugger.html#v8-inspector-integration-for-nodejs">V8 Inspector integration for Node.js</a> for further explanation on Node.js debugger.</p>
<h4><code>--inspect[=[host:]port]</code><span><a class="mark" href="#--inspecthostport" id="--inspecthostport">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_host_port"></a></h4>
<div class="api_metadata">
<span>Added in: v6.3.0</span>
</div>
<p>Activate inspector on <code>host:port</code>. Default is <code>127.0.0.1:9229</code>. If port <code>0</code> is
specified, a random available port will be used.</p>
<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
and profile Node.js instances. The tools attach to Node.js instances via a
tcp port and communicate using the <a href="https://chromedevtools.github.io/devtools-protocol/">Chrome DevTools Protocol</a>.
See <a href="debugger.html#v8-inspector-integration-for-nodejs">V8 Inspector integration for Node.js</a> for further explanation on Node.js debugger.</p>
<!-- Anchor to make sure old links find a target -->
<p><a id="inspector_security"></a></p>
<h5>Warning: binding inspector to a public IP:port combination is insecure<span><a class="mark" href="#warning-binding-inspector-to-a-public-ipport-combination-is-insecure" id="warning-binding-inspector-to-a-public-ipport-combination-is-insecure">#</a></span><a aria-hidden="true" class="legacy" id="cli_warning_binding_inspector_to_a_public_ip_port_combination_is_insecure"></a></h5>
<p>Binding the inspector to a public IP (including <code>0.0.0.0</code>) with an open port is
insecure, as it allows external hosts to connect to the inspector and perform
a <a href="https://www.owasp.org/index.php/Code_Injection">remote code execution</a> attack.</p>
<p>If specifying a host, make sure that either:</p>
<ul>
<li>The host is not accessible from public networks.</li>
<li>A firewall disallows unwanted connections on the port.</li>
</ul>
<p><strong>More specifically, <code>--inspect=0.0.0.0</code> is insecure if the port (<code>9229</code> by
default) is not firewall-protected.</strong></p>
<p>See the <a href="https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implications">debugging security implications</a> section for more information.</p>
<h4><code>-i</code>, <code>--interactive</code><span><a class="mark" href="#-i---interactive" id="-i---interactive">#</a></span><a aria-hidden="true" class="legacy" id="cli_i_interactive"></a></h4>
<div class="api_metadata">
<span>Added in: v0.7.7</span>
</div>
<p>Opens the REPL even if stdin does not appear to be a terminal.</p>
<h4><code>--jitless</code><span><a class="mark" href="#--jitless" id="--jitless">#</a></span><a aria-hidden="true" class="legacy" id="cli_jitless"></a></h4>
<div class="api_metadata">
<span>Added in: v12.0.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental. This flag is inherited from V8 and is subject to
change upstream.</div><p></p>
<p>Disable <a href="https://v8.dev/blog/jitless">runtime allocation of executable memory</a>. This may be
required on some platforms for security reasons. It can also reduce attack
surface on other platforms, but the performance impact may be severe.</p>
<h4><code>--localstorage-file=file</code><span><a class="mark" href="#--localstorage-filefile" id="--localstorage-filefile">#</a></span><a aria-hidden="true" class="legacy" id="cli_localstorage_file_file"></a></h4>
<div class="api_metadata">
<span>Added in: v22.4.0</span>
</div>
<p>The file used to store <code>localStorage</code> data. If the file does not exist, it is
created the first time <code>localStorage</code> is accessed. The same file may be shared
between multiple Node.js processes concurrently. This flag is a no-op unless
Node.js is started with the <code>--experimental-webstorage</code> flag.</p>
<h4><code>--max-http-header-size=size</code><span><a class="mark" href="#--max-http-header-sizesize" id="--max-http-header-sizesize">#</a></span><a aria-hidden="true" class="legacy" id="cli_max_http_header_size_size"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v13.13.0</td>
<td><p>Change maximum default size of HTTP headers from 8 KiB to 16 KiB.</p></td></tr>
<tr><td>v11.6.0, v10.15.0</td>
<td><p><span>Added in: v11.6.0, v10.15.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB.</p>
<h4><code>--napi-modules</code><span><a class="mark" href="#--napi-modules" id="--napi-modules">#</a></span><a aria-hidden="true" class="legacy" id="cli_napi_modules"></a></h4>
<div class="api_metadata">
<span>Added in: v7.10.0</span>
</div>
<p>This option is a no-op. It is kept for compatibility.</p>
<h4><code>--network-family-autoselection-attempt-timeout</code><span><a class="mark" href="#--network-family-autoselection-attempt-timeout" id="--network-family-autoselection-attempt-timeout">#</a></span><a aria-hidden="true" class="legacy" id="cli_network_family_autoselection_attempt_timeout"></a></h4>
<div class="api_metadata">
<span>Added in: v22.1.0</span>
</div>
<p>Sets the default value for the network family autoselection attempt timeout.
For more information, see <a href="net.html#netgetdefaultautoselectfamilyattempttimeout"><code>net.getDefaultAutoSelectFamilyAttemptTimeout()</code></a>.</p>
<h4><code>--no-addons</code><span><a class="mark" href="#--no-addons" id="--no-addons">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_addons"></a></h4>
<div class="api_metadata">
<span>Added in: v16.10.0, v14.19.0</span>
</div>
<p>Disable the <code>node-addons</code> exports condition as well as disable loading
native addons. When <code>--no-addons</code> is specified, calling <code>process.dlopen</code> or
requiring a native C++ addon will fail and throw an exception.</p>
<h4><code>--no-deprecation</code><span><a class="mark" href="#--no-deprecation" id="--no-deprecation">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_deprecation"></a></h4>
<div class="api_metadata">
<span>Added in: v0.8.0</span>
</div>
<p>Silence deprecation warnings.</p>
<h4><code>--no-experimental-detect-module</code><span><a class="mark" href="#--no-experimental-detect-module" id="--no-experimental-detect-module">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_detect_module"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.7.0</td>
<td><p>Syntax detection is enabled by default.</p></td></tr>
<tr><td>v21.1.0, v20.10.0</td>
<td><p><span>Added in: v21.1.0, v20.10.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Disable using <a href="packages.html#syntax-detection">syntax detection</a> to determine module type.</p>
<h4><code>--no-experimental-fetch</code><span><a class="mark" href="#--no-experimental-fetch" id="--no-experimental-fetch">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_fetch"></a></h4>
<div class="api_metadata">
<span>Added in: v18.0.0</span>
</div>
<p>Disable exposition of <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">Fetch API</a> on the global scope.</p>
<h4><code>--no-experimental-global-customevent</code><span><a class="mark" href="#--no-experimental-global-customevent" id="--no-experimental-global-customevent">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_global_customevent"></a></h4>
<div class="api_metadata">
<span>Added in: v19.0.0</span>
</div>
<p>Disable exposition of <a href="https://dom.spec.whatwg.org/#customevent">CustomEvent Web API</a> on the global scope.</p>
<h4><code>--no-experimental-global-navigator</code><span><a class="mark" href="#--no-experimental-global-navigator" id="--no-experimental-global-navigator">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_global_navigator"></a></h4>
<div class="api_metadata">
<span>Added in: v21.2.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Disable exposition of <a href="globals.html#navigator">Navigator API</a> on the global scope.</p>
<h4><code>--no-experimental-global-webcrypto</code><span><a class="mark" href="#--no-experimental-global-webcrypto" id="--no-experimental-global-webcrypto">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_global_webcrypto"></a></h4>
<div class="api_metadata">
<span>Added in: v19.0.0</span>
</div>
<p>Disable exposition of <a href="webcrypto.html">Web Crypto API</a> on the global scope.</p>
<h4><code>--no-experimental-repl-await</code><span><a class="mark" href="#--no-experimental-repl-await" id="--no-experimental-repl-await">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_repl_await"></a></h4>
<div class="api_metadata">
<span>Added in: v16.6.0</span>
</div>
<p>Use this flag to disable top-level await in REPL.</p>
<h4><code>--no-experimental-require-module</code><span><a class="mark" href="#--no-experimental-require-module" id="--no-experimental-require-module">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_require_module"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.12.0</td>
<td><p>This is now false by default.</p></td></tr>
<tr><td>v22.0.0</td>
<td><p><span>Added in: v22.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active Development</div><p></p>
<p>Disable support for loading a synchronous ES module graph in <code>require()</code>.</p>
<p>See <a href="modules.html#loading-ecmascript-modules-using-require">Loading ECMAScript modules using <code>require()</code></a>.</p>
<h4><code>--no-experimental-sqlite</code><span><a class="mark" href="#--no-experimental-sqlite" id="--no-experimental-sqlite">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_sqlite"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.13.0</td>
<td><p>SQLite is unflagged but still experimental.</p></td></tr>
<tr><td>v22.5.0</td>
<td><p><span>Added in: v22.5.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Disable the experimental <a href="sqlite.html"><code>node:sqlite</code></a> module.</p>
<h4><code>--no-experimental-websocket</code><span><a class="mark" href="#--no-experimental-websocket" id="--no-experimental-websocket">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_websocket"></a></h4>
<div class="api_metadata">
<span>Added in: v22.0.0</span>
</div>
<p>Disable exposition of <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSocket"><code>WebSocket</code></a> on the global scope.</p>
<h4><code>--no-extra-info-on-fatal-exception</code><span><a class="mark" href="#--no-extra-info-on-fatal-exception" id="--no-extra-info-on-fatal-exception">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_extra_info_on_fatal_exception"></a></h4>
<div class="api_metadata">
<span>Added in: v17.0.0</span>
</div>
<p>Hide extra information on fatal exception that causes exit.</p>
<h4><code>--no-force-async-hooks-checks</code><span><a class="mark" href="#--no-force-async-hooks-checks" id="--no-force-async-hooks-checks">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_force_async_hooks_checks"></a></h4>
<div class="api_metadata">
<span>Added in: v9.0.0</span>
</div>
<p>Disables runtime checks for <code>async_hooks</code>. These will still be enabled
dynamically when <code>async_hooks</code> is enabled.</p>
<h4><code>--no-global-search-paths</code><span><a class="mark" href="#--no-global-search-paths" id="--no-global-search-paths">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_global_search_paths"></a></h4>
<div class="api_metadata">
<span>Added in: v16.10.0</span>
</div>
<p>Do not search modules from global paths like <code>$HOME/.node_modules</code> and
<code>$NODE_PATH</code>.</p>
<h4><code>--no-network-family-autoselection</code><span><a class="mark" href="#--no-network-family-autoselection" id="--no-network-family-autoselection">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_network_family_autoselection"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.0.0</td>
<td><p>The flag was renamed from <code>--no-enable-network-family-autoselection</code> to <code>--no-network-family-autoselection</code>. The old name can still work as an alias.</p></td></tr>
<tr><td>v19.4.0</td>
<td><p><span>Added in: v19.4.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Disables the family autoselection algorithm unless connection options explicitly
enables it.</p>
<h4><code>--no-warnings</code><span><a class="mark" href="#--no-warnings" id="--no-warnings">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_warnings"></a></h4>
<div class="api_metadata">
<span>Added in: v6.0.0</span>
</div>
<p>Silence all process warnings (including deprecations).</p>
<h4><code>--node-memory-debug</code><span><a class="mark" href="#--node-memory-debug" id="--node-memory-debug">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_memory_debug"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0, v14.18.0</span>
</div>
<p>Enable extra debug checks for memory leaks in Node.js internals. This is
usually only useful for developers debugging Node.js itself.</p>
<h4><code>--openssl-config=file</code><span><a class="mark" href="#--openssl-configfile" id="--openssl-configfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_openssl_config_file"></a></h4>
<div class="api_metadata">
<span>Added in: v6.9.0</span>
</div>
<p>Load an OpenSSL configuration file on startup. Among other uses, this can be
used to enable FIPS-compliant crypto if Node.js is built
against FIPS-enabled OpenSSL.</p>
<h4><code>--openssl-legacy-provider</code><span><a class="mark" href="#--openssl-legacy-provider" id="--openssl-legacy-provider">#</a></span><a aria-hidden="true" class="legacy" id="cli_openssl_legacy_provider"></a></h4>
<div class="api_metadata">
<span>Added in: v17.0.0, v16.17.0</span>
</div>
<p>Enable OpenSSL 3.0 legacy provider. For more information please see
<a href="https://www.openssl.org/docs/man3.0/man7/OSSL_PROVIDER-legacy.html">OSSL_PROVIDER-legacy</a>.</p>
<h4><code>--openssl-shared-config</code><span><a class="mark" href="#--openssl-shared-config" id="--openssl-shared-config">#</a></span><a aria-hidden="true" class="legacy" id="cli_openssl_shared_config"></a></h4>
<div class="api_metadata">
<span>Added in: v18.5.0, v16.17.0, v14.21.0</span>
</div>
<p>Enable OpenSSL default configuration section, <code>openssl_conf</code> to be read from
the OpenSSL configuration file. The default configuration file is named
<code>openssl.cnf</code> but this can be changed using the environment variable
<code>OPENSSL_CONF</code>, or by using the command line option <code>--openssl-config</code>.
The location of the default OpenSSL configuration file depends on how OpenSSL
is being linked to Node.js. Sharing the OpenSSL configuration may have unwanted
implications and it is recommended to use a configuration section specific to
Node.js which is <code>nodejs_conf</code> and is default when this option is not used.</p>
<h4><code>--pending-deprecation</code><span><a class="mark" href="#--pending-deprecation" id="--pending-deprecation">#</a></span><a aria-hidden="true" class="legacy" id="cli_pending_deprecation"></a></h4>
<div class="api_metadata">
<span>Added in: v8.0.0</span>
</div>
<p>Emit pending deprecation warnings.</p>
<p>Pending deprecations are generally identical to a runtime deprecation with the
notable exception that they are turned <em>off</em> by default and will not be emitted
unless either the <code>--pending-deprecation</code> command-line flag, or the
<code>NODE_PENDING_DEPRECATION=1</code> environment variable, is set. Pending deprecations
are used to provide a kind of selective "early warning" mechanism that
developers may leverage to detect deprecated API usage.</p>
<h4><code>--permission</code><span><a class="mark" href="#--permission" id="--permission">#</a></span><a aria-hidden="true" class="legacy" id="cli_permission"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.13.0</td>
<td><p>Permission Model is now stable.</p></td></tr>
<tr><td>v20.0.0</td>
<td><p><span>Added in: v20.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable.</div><p></p>
<p>Enable the Permission Model for current process. When enabled, the
following permissions are restricted:</p>
<ul>
<li>File System - manageable through
<a href="#--allow-fs-read"><code>--allow-fs-read</code></a>, <a href="#--allow-fs-write"><code>--allow-fs-write</code></a> flags</li>
<li>Child Process - manageable through <a href="#--allow-child-process"><code>--allow-child-process</code></a> flag</li>
<li>Worker Threads - manageable through <a href="#--allow-worker"><code>--allow-worker</code></a> flag</li>
<li>WASI - manageable through <a href="#--allow-wasi"><code>--allow-wasi</code></a> flag</li>
<li>Addons - manageable through <a href="#--allow-addons"><code>--allow-addons</code></a> flag</li>
</ul>
<h4><code>--preserve-symlinks</code><span><a class="mark" href="#--preserve-symlinks" id="--preserve-symlinks">#</a></span><a aria-hidden="true" class="legacy" id="cli_preserve_symlinks"></a></h4>
<div class="api_metadata">
<span>Added in: v6.3.0</span>
</div>
<p>Instructs the module loader to preserve symbolic links when resolving and
caching modules.</p>
<p>By default, when Node.js loads a module from a path that is symbolically linked
to a different on-disk location, Node.js will dereference the link and use the
actual on-disk "real path" of the module as both an identifier and as a root
path to locate other dependency modules. In most cases, this default behavior
is acceptable. However, when using symbolically linked peer dependencies, as
illustrated in the example below, the default behavior causes an exception to
be thrown if <code>moduleA</code> attempts to require <code>moduleB</code> as a peer dependency:</p>
<pre><code class="language-text">{appDir}
├── app
│ ├── index.js
│ └── node_modules
│ ├── moduleA -> {appDir}/moduleA
│ └── moduleB
│ ├── index.js
│ └── package.json
└── moduleA
├── index.js
└── package.json</code> <button class="copy-button">copy</button></pre>
<p>The <code>--preserve-symlinks</code> command-line flag instructs Node.js to use the
symlink path for modules as opposed to the real path, allowing symbolically
linked peer dependencies to be found.</p>
<p>Note, however, that using <code>--preserve-symlinks</code> can have other side effects.
Specifically, symbolically linked <em>native</em> modules can fail to load if those
are linked from more than one location in the dependency tree (Node.js would
see those as two separate modules and would attempt to load the module multiple
times, causing an exception to be thrown).</p>
<p>The <code>--preserve-symlinks</code> flag does not apply to the main module, which allows
<code>node --preserve-symlinks node_module/.bin/<foo></code> to work. To apply the same
behavior for the main module, also use <code>--preserve-symlinks-main</code>.</p>
<h4><code>--preserve-symlinks-main</code><span><a class="mark" href="#--preserve-symlinks-main" id="--preserve-symlinks-main">#</a></span><a aria-hidden="true" class="legacy" id="cli_preserve_symlinks_main"></a></h4>
<div class="api_metadata">
<span>Added in: v10.2.0</span>
</div>
<p>Instructs the module loader to preserve symbolic links when resolving and
caching the main module (<code>require.main</code>).</p>
<p>This flag exists so that the main module can be opted-in to the same behavior
that <code>--preserve-symlinks</code> gives to all other imports; they are separate flags,
however, for backward compatibility with older Node.js versions.</p>
<p><code>--preserve-symlinks-main</code> does not imply <code>--preserve-symlinks</code>; use
<code>--preserve-symlinks-main</code> in addition to
<code>--preserve-symlinks</code> when it is not desirable to follow symlinks before
resolving relative paths.</p>
<p>See <a href="#--preserve-symlinks"><code>--preserve-symlinks</code></a> for more information.</p>
<h4><code>-p</code>, <code>--print "script"</code><span><a class="mark" href="#-p---print-script" id="-p---print-script">#</a></span><a aria-hidden="true" class="legacy" id="cli_p_print_script"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v5.11.0</td>
<td><p>Built-in libraries are now available as predefined variables.</p></td></tr>
<tr><td>v0.6.4</td>
<td><p><span>Added in: v0.6.4</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Identical to <code>-e</code> but prints the result.</p>
<h4><code>--prof</code><span><a class="mark" href="#--prof" id="--prof">#</a></span><a aria-hidden="true" class="legacy" id="cli_prof"></a></h4>
<div class="api_metadata">
<span>Added in: v2.0.0</span>
</div>
<p>Generate V8 profiler output.</p>
<h4><code>--prof-process</code><span><a class="mark" href="#--prof-process" id="--prof-process">#</a></span><a aria-hidden="true" class="legacy" id="cli_prof_process"></a></h4>
<div class="api_metadata">
<span>Added in: v5.2.0</span>
</div>
<p>Process V8 profiler output generated using the V8 option <code>--prof</code>.</p>
<h4><code>--redirect-warnings=file</code><span><a class="mark" href="#--redirect-warningsfile" id="--redirect-warningsfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_redirect_warnings_file"></a></h4>
<div class="api_metadata">
<span>Added in: v8.0.0</span>
</div>
<p>Write process warnings to the given file instead of printing to stderr. The
file will be created if it does not exist, and will be appended to if it does.
If an error occurs while attempting to write the warning to the file, the
warning will be written to stderr instead.</p>
<p>The <code>file</code> name may be an absolute path. If it is not, the default directory it
will be written to is controlled by the
<a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir</code></a> command-line option.</p>
<h4><code>--report-compact</code><span><a class="mark" href="#--report-compact" id="--report-compact">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_compact"></a></h4>
<div class="api_metadata">
<span>Added in: v13.12.0, v12.17.0</span>
</div>
<p>Write reports in a compact format, single-line JSON, more easily consumable
by log processing systems than the default multi-line format designed for
human consumption.</p>
<h4><code>--report-dir=directory</code>, <code>report-directory=directory</code><span><a class="mark" href="#--report-dirdirectory-report-directorydirectory" id="--report-dirdirectory-report-directorydirectory">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_dir_directory_report_directory_directory"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v13.12.0, v12.17.0</td>
<td><p>This option is no longer experimental.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p>Changed from <code>--diagnostic-report-directory</code> to <code>--report-directory</code>.</p></td></tr>
<tr><td>v11.8.0</td>
<td><p><span>Added in: v11.8.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Location at which the report will be generated.</p>
<h4><code>--report-exclude-env</code><span><a class="mark" href="#--report-exclude-env" id="--report-exclude-env">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_exclude_env"></a></h4>
<div class="api_metadata">
<span>Added in: v22.13.0</span>
</div>
<p>When <code>--report-exclude-env</code> is passed the diagnostic report generated will not
contain the <code>environmentVariables</code> data.</p>
<h4><code>--report-exclude-network</code><span><a class="mark" href="#--report-exclude-network" id="--report-exclude-network">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_exclude_network"></a></h4>
<div class="api_metadata">
<span>Added in: v22.0.0</span>
</div>
<p>Exclude <code>header.networkInterfaces</code> from the diagnostic report. By default
this is not set and the network interfaces are included.</p>
<h4><code>--report-filename=filename</code><span><a class="mark" href="#--report-filenamefilename" id="--report-filenamefilename">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_filename_filename"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v13.12.0, v12.17.0</td>
<td><p>This option is no longer experimental.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p>changed from <code>--diagnostic-report-filename</code> to <code>--report-filename</code>.</p></td></tr>
<tr><td>v11.8.0</td>
<td><p><span>Added in: v11.8.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Name of the file to which the report will be written.</p>
<p>If the filename is set to <code>'stdout'</code> or <code>'stderr'</code>, the report is written to
the stdout or stderr of the process respectively.</p>
<h4><code>--report-on-fatalerror</code><span><a class="mark" href="#--report-on-fatalerror" id="--report-on-fatalerror">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_on_fatalerror"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v14.0.0, v13.14.0, v12.17.0</td>
<td><p>This option is no longer experimental.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p>changed from <code>--diagnostic-report-on-fatalerror</code> to <code>--report-on-fatalerror</code>.</p></td></tr>
<tr><td>v11.8.0</td>
<td><p><span>Added in: v11.8.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Enables the report to be triggered on fatal errors (internal errors within
the Node.js runtime such as out of memory) that lead to termination of the
application. Useful to inspect various diagnostic data elements such as heap,
stack, event loop state, resource consumption etc. to reason about the fatal
error.</p>
<h4><code>--report-on-signal</code><span><a class="mark" href="#--report-on-signal" id="--report-on-signal">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_on_signal"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v13.12.0, v12.17.0</td>
<td><p>This option is no longer experimental.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p>changed from <code>--diagnostic-report-on-signal</code> to <code>--report-on-signal</code>.</p></td></tr>
<tr><td>v11.8.0</td>
<td><p><span>Added in: v11.8.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Enables report to be generated upon receiving the specified (or predefined)
signal to the running Node.js process. The signal to trigger the report is
specified through <code>--report-signal</code>.</p>
<h4><code>--report-signal=signal</code><span><a class="mark" href="#--report-signalsignal" id="--report-signalsignal">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_signal_signal"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v13.12.0, v12.17.0</td>
<td><p>This option is no longer experimental.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p>changed from <code>--diagnostic-report-signal</code> to <code>--report-signal</code>.</p></td></tr>
<tr><td>v11.8.0</td>
<td><p><span>Added in: v11.8.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Sets or resets the signal for report generation (not supported on Windows).
Default signal is <code>SIGUSR2</code>.</p>
<h4><code>--report-uncaught-exception</code><span><a class="mark" href="#--report-uncaught-exception" id="--report-uncaught-exception">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_uncaught_exception"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v18.8.0, v16.18.0</td>
<td><p>Report is not generated if the uncaught exception is handled.</p></td></tr>
<tr><td>v13.12.0, v12.17.0</td>
<td><p>This option is no longer experimental.</p></td></tr>
<tr><td>v12.0.0</td>
<td><p>changed from <code>--diagnostic-report-uncaught-exception</code> to <code>--report-uncaught-exception</code>.</p></td></tr>
<tr><td>v11.8.0</td>
<td><p><span>Added in: v11.8.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Enables report to be generated when the process exits due to an uncaught
exception. Useful when inspecting the JavaScript stack in conjunction with
native stack and other runtime environment data.</p>
<h4><code>-r</code>, <code>--require module</code><span><a class="mark" href="#-r---require-module" id="-r---require-module">#</a></span><a aria-hidden="true" class="legacy" id="cli_r_require_module"></a></h4>
<div class="api_metadata">
<span>Added in: v1.6.0</span>
</div>
<p>Preload the specified module at startup.</p>
<p>Follows <code>require()</code>'s module resolution
rules. <code>module</code> may be either a path to a file, or a node module name.</p>
<p>Only CommonJS modules are supported.
Use <a href="#--importmodule"><code>--import</code></a> to preload an <a href="esm.html#modules-ecmascript-modules">ECMAScript module</a>.
Modules preloaded with <code>--require</code> will run before modules preloaded with <code>--import</code>.</p>
<p>Modules are preloaded into the main thread as well as any worker threads,
forked processes, or clustered processes.</p>
<h4><code>--run</code><span><a class="mark" href="#--run" id="--run">#</a></span><a aria-hidden="true" class="legacy" id="cli_run"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.3.0</td>
<td><p>NODE_RUN_SCRIPT_NAME environment variable is added.</p></td></tr>
<tr><td>v22.3.0</td>
<td><p>NODE_RUN_PACKAGE_JSON_PATH environment variable is added.</p></td></tr>
<tr><td>v22.3.0</td>
<td><p>Traverses up to the root directory and finds a <code>package.json</code> file to run the command from, and updates <code>PATH</code> environment variable accordingly.</p></td></tr>
<tr><td>v22.0.0</td>
<td><p><span>Added in: v22.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>This runs a specified command from a package.json's <code>"scripts"</code> object.
If a missing <code>"command"</code> is provided, it will list the available scripts.</p>
<p><code>--run</code> will traverse up to the root directory and finds a <code>package.json</code>
file to run the command from.</p>
<p><code>--run</code> prepends <code>./node_modules/.bin</code> for each ancestor of
the current directory, to the <code>PATH</code> in order to execute the binaries from
different folders where multiple <code>node_modules</code> directories are present, if
<code>ancestor-folder/node_modules/.bin</code> is a directory.</p>
<p><code>--run</code> executes the command in the directory containing the related <code>package.json</code>.</p>
<p>For example, the following command will run the <code>test</code> script of
the <code>package.json</code> in the current folder:</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --run <span class="hljs-built_in">test</span></span></code> <button class="copy-button">copy</button></pre>
<p>You can also pass arguments to the command. Any argument after <code>--</code> will
be appended to the script:</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --run <span class="hljs-built_in">test</span> -- --verbose</span></code> <button class="copy-button">copy</button></pre>
<h5>Intentional limitations<span><a class="mark" href="#intentional-limitations" id="intentional-limitations">#</a></span><a aria-hidden="true" class="legacy" id="cli_intentional_limitations"></a></h5>
<p><code>node --run</code> is not meant to match the behaviors of <code>npm run</code> or of the <code>run</code>
commands of other package managers. The Node.js implementation is intentionally
more limited, in order to focus on top performance for the most common use
cases.
Some features of other <code>run</code> implementations that are intentionally excluded
are:</p>
<ul>
<li>Running <code>pre</code> or <code>post</code> scripts in addition to the specified script.</li>
<li>Defining package manager-specific environment variables.</li>
</ul>
<h5>Environment variables<span><a class="mark" href="#environment-variables" id="environment-variables">#</a></span><a aria-hidden="true" class="legacy" id="cli_environment_variables"></a></h5>
<p>The following environment variables are set when running a script with <code>--run</code>:</p>
<ul>
<li><code>NODE_RUN_SCRIPT_NAME</code>: The name of the script being run. For example, if
<code>--run</code> is used to run <code>test</code>, the value of this variable will be <code>test</code>.</li>
<li><code>NODE_RUN_PACKAGE_JSON_PATH</code>: The path to the <code>package.json</code> that is being
processed.</li>
</ul>
<h4><code>--secure-heap-min=n</code><span><a class="mark" href="#--secure-heap-minn" id="--secure-heap-minn">#</a></span><a aria-hidden="true" class="legacy" id="cli_secure_heap_min_n"></a></h4>
<div class="api_metadata">
<span>Added in: v15.6.0</span>
</div>
<p>When using <code>--secure-heap</code>, the <code>--secure-heap-min</code> flag specifies the
minimum allocation from the secure heap. The minimum value is <code>2</code>.
The maximum value is the lesser of <code>--secure-heap</code> or <code>2147483647</code>.
The value given must be a power of two.</p>
<h4><code>--secure-heap=n</code><span><a class="mark" href="#--secure-heapn" id="--secure-heapn">#</a></span><a aria-hidden="true" class="legacy" id="cli_secure_heap_n"></a></h4>
<div class="api_metadata">
<span>Added in: v15.6.0</span>
</div>
<p>Initializes an OpenSSL secure heap of <code>n</code> bytes. When initialized, the
secure heap is used for selected types of allocations within OpenSSL
during key generation and other operations. This is useful, for instance,
to prevent sensitive information from leaking due to pointer overruns
or underruns.</p>
<p>The secure heap is a fixed size and cannot be resized at runtime so,
if used, it is important to select a large enough heap to cover all
application uses.</p>
<p>The heap size given must be a power of two. Any value less than 2
will disable the secure heap.</p>
<p>The secure heap is disabled by default.</p>
<p>The secure heap is not available on Windows.</p>
<p>See <a href="https://www.openssl.org/docs/man3.0/man3/CRYPTO_secure_malloc_init.html"><code>CRYPTO_secure_malloc_init</code></a> for more details.</p>
<h4><code>--snapshot-blob=path</code><span><a class="mark" href="#--snapshot-blobpath" id="--snapshot-blobpath">#</a></span><a aria-hidden="true" class="legacy" id="cli_snapshot_blob_path"></a></h4>
<div class="api_metadata">
<span>Added in: v18.8.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>When used with <code>--build-snapshot</code>, <code>--snapshot-blob</code> specifies the path
where the generated snapshot blob is written to. If not specified, the
generated blob is written to <code>snapshot.blob</code> in the current working directory.</p>
<p>When used without <code>--build-snapshot</code>, <code>--snapshot-blob</code> specifies the
path to the blob that is used to restore the application state.</p>
<p>When loading a snapshot, Node.js checks that:</p>
<ol>
<li>The version, architecture, and platform of the running Node.js binary
are exactly the same as that of the binary that generates the snapshot.</li>
<li>The V8 flags and CPU features are compatible with that of the binary
that generates the snapshot.</li>
</ol>
<p>If they don't match, Node.js refuses to load the snapshot and exits with
status code 1.</p>
<h4><code>--test</code><span><a class="mark" href="#--test" id="--test">#</a></span><a aria-hidden="true" class="legacy" id="cli_test"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.0.0</td>
<td><p>The test runner is now stable.</p></td></tr>
<tr><td>v19.2.0, v18.13.0</td>
<td><p>Test runner now supports running in watch mode.</p></td></tr>
<tr><td>v18.1.0, v16.17.0</td>
<td><p><span>Added in: v18.1.0, v16.17.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Starts the Node.js command line test runner. This flag cannot be combined with
<code>--watch-path</code>, <code>--check</code>, <code>--eval</code>, <code>--interactive</code>, or the inspector.
See the documentation on <a href="test.html#running-tests-from-the-command-line">running tests from the command line</a>
for more details.</p>
<h4><code>--test-concurrency</code><span><a class="mark" href="#--test-concurrency" id="--test-concurrency">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_concurrency"></a></h4>
<div class="api_metadata">
<span>Added in: v21.0.0, v20.10.0, v18.19.0</span>
</div>
<p>The maximum number of test files that the test runner CLI will execute
concurrently. If <code>--experimental-test-isolation</code> is set to <code>'none'</code>, this flag
is ignored and concurrency is one. Otherwise, concurrency defaults to
<code>os.availableParallelism() - 1</code>.</p>
<h4><code>--test-coverage-branches=threshold</code><span><a class="mark" href="#--test-coverage-branchesthreshold" id="--test-coverage-branchesthreshold">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_coverage_branches_threshold"></a></h4>
<div class="api_metadata">
<span>Added in: v22.8.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Require a minimum percent of covered branches. If code coverage does not reach
the threshold specified, the process will exit with code <code>1</code>.</p>
<h4><code>--test-coverage-exclude</code><span><a class="mark" href="#--test-coverage-exclude" id="--test-coverage-exclude">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_coverage_exclude"></a></h4>
<div class="api_metadata">
<span>Added in: v22.5.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Excludes specific files from code coverage using a glob pattern, which can match
both absolute and relative file paths.</p>
<p>This option may be specified multiple times to exclude multiple glob patterns.</p>
<p>If both <code>--test-coverage-exclude</code> and <code>--test-coverage-include</code> are provided,
files must meet <strong>both</strong> criteria to be included in the coverage report.</p>
<h4><code>--test-coverage-functions=threshold</code><span><a class="mark" href="#--test-coverage-functionsthreshold" id="--test-coverage-functionsthreshold">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_coverage_functions_threshold"></a></h4>
<div class="api_metadata">
<span>Added in: v22.8.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Require a minimum percent of covered functions. If code coverage does not reach
the threshold specified, the process will exit with code <code>1</code>.</p>
<h4><code>--test-coverage-include</code><span><a class="mark" href="#--test-coverage-include" id="--test-coverage-include">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_coverage_include"></a></h4>
<div class="api_metadata">
<span>Added in: v22.5.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Includes specific files in code coverage using a glob pattern, which can match
both absolute and relative file paths.</p>
<p>This option may be specified multiple times to include multiple glob patterns.</p>
<p>If both <code>--test-coverage-exclude</code> and <code>--test-coverage-include</code> are provided,
files must meet <strong>both</strong> criteria to be included in the coverage report.</p>
<h4><code>--test-coverage-lines=threshold</code><span><a class="mark" href="#--test-coverage-linesthreshold" id="--test-coverage-linesthreshold">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_coverage_lines_threshold"></a></h4>
<div class="api_metadata">
<span>Added in: v22.8.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>Require a minimum percent of covered lines. If code coverage does not reach
the threshold specified, the process will exit with code <code>1</code>.</p>
<h4><code>--test-force-exit</code><span><a class="mark" href="#--test-force-exit" id="--test-force-exit">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_force_exit"></a></h4>
<div class="api_metadata">
<span>Added in: v22.0.0</span>
</div>
<p>Configures the test runner to exit the process once all known tests have
finished executing even if the event loop would otherwise remain active.</p>
<h4><code>--test-name-pattern</code><span><a class="mark" href="#--test-name-pattern" id="--test-name-pattern">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_name_pattern"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.0.0</td>
<td><p>The test runner is now stable.</p></td></tr>
<tr><td>v18.11.0</td>
<td><p><span>Added in: v18.11.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>A regular expression that configures the test runner to only execute tests
whose name matches the provided pattern. See the documentation on
<a href="test.html#filtering-tests-by-name">filtering tests by name</a> for more details.</p>
<p>If both <code>--test-name-pattern</code> and <code>--test-skip-pattern</code> are supplied,
tests must satisfy <strong>both</strong> requirements in order to be executed.</p>
<h4><code>--test-only</code><span><a class="mark" href="#--test-only" id="--test-only">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_only"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.0.0</td>
<td><p>The test runner is now stable.</p></td></tr>
<tr><td>v18.0.0, v16.17.0</td>
<td><p><span>Added in: v18.0.0, v16.17.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Configures the test runner to only execute top level tests that have the <code>only</code>
option set. This flag is not necessary when test isolation is disabled.</p>
<h4><code>--test-reporter</code><span><a class="mark" href="#--test-reporter" id="--test-reporter">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_reporter"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.0.0</td>
<td><p>The test runner is now stable.</p></td></tr>
<tr><td>v19.6.0, v18.15.0</td>
<td><p><span>Added in: v19.6.0, v18.15.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>A test reporter to use when running tests. See the documentation on
<a href="test.html#test-reporters">test reporters</a> for more details.</p>
<h4><code>--test-reporter-destination</code><span><a class="mark" href="#--test-reporter-destination" id="--test-reporter-destination">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_reporter_destination"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v20.0.0</td>
<td><p>The test runner is now stable.</p></td></tr>
<tr><td>v19.6.0, v18.15.0</td>
<td><p><span>Added in: v19.6.0, v18.15.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>The destination for the corresponding test reporter. See the documentation on
<a href="test.html#test-reporters">test reporters</a> for more details.</p>
<h4><code>--test-shard</code><span><a class="mark" href="#--test-shard" id="--test-shard">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_shard"></a></h4>
<div class="api_metadata">
<span>Added in: v20.5.0, v18.19.0</span>
</div>
<p>Test suite shard to execute in a format of <code><index>/<total></code>, where</p>
<p><code>index</code> is a positive integer, index of divided parts
<code>total</code> is a positive integer, total of divided part
This command will divide all tests files into <code>total</code> equal parts,
and will run only those that happen to be in an <code>index</code> part.</p>
<p>For example, to split your tests suite into three parts, use this:</p>
<pre><code class="language-bash">node --<span class="hljs-built_in">test</span> --test-shard=1/3
node --<span class="hljs-built_in">test</span> --test-shard=2/3
node --<span class="hljs-built_in">test</span> --test-shard=3/3</code> <button class="copy-button">copy</button></pre>
<h4><code>--test-skip-pattern</code><span><a class="mark" href="#--test-skip-pattern" id="--test-skip-pattern">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_skip_pattern"></a></h4>
<div class="api_metadata">
<span>Added in: v22.1.0</span>
</div>
<p>A regular expression that configures the test runner to skip tests
whose name matches the provided pattern. See the documentation on
<a href="test.html#filtering-tests-by-name">filtering tests by name</a> for more details.</p>
<p>If both <code>--test-name-pattern</code> and <code>--test-skip-pattern</code> are supplied,
tests must satisfy <strong>both</strong> requirements in order to be executed.</p>
<h4><code>--test-timeout</code><span><a class="mark" href="#--test-timeout" id="--test-timeout">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_timeout"></a></h4>
<div class="api_metadata">
<span>Added in: v21.2.0, v20.11.0</span>
</div>
<p>A number of milliseconds the test execution will fail after. If unspecified,
subtests inherit this value from their parent. The default value is <code>Infinity</code>.</p>
<h4><code>--test-update-snapshots</code><span><a class="mark" href="#--test-update-snapshots" id="--test-update-snapshots">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_update_snapshots"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.13.0</td>
<td><p>Snapsnot testing is no longer experimental.</p></td></tr>
<tr><td>v22.3.0</td>
<td><p><span>Added in: v22.3.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Regenerates the snapshot files used by the test runner for <a href="test.html#snapshot-testing">snapshot testing</a>.</p>
<h4><code>--throw-deprecation</code><span><a class="mark" href="#--throw-deprecation" id="--throw-deprecation">#</a></span><a aria-hidden="true" class="legacy" id="cli_throw_deprecation"></a></h4>
<div class="api_metadata">
<span>Added in: v0.11.14</span>
</div>
<p>Throw errors for deprecations.</p>
<h4><code>--title=title</code><span><a class="mark" href="#--titletitle" id="--titletitle">#</a></span><a aria-hidden="true" class="legacy" id="cli_title_title"></a></h4>
<div class="api_metadata">
<span>Added in: v10.7.0</span>
</div>
<p>Set <code>process.title</code> on startup.</p>
<h4><code>--tls-cipher-list=list</code><span><a class="mark" href="#--tls-cipher-listlist" id="--tls-cipher-listlist">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_cipher_list_list"></a></h4>
<div class="api_metadata">
<span>Added in: v4.0.0</span>
</div>
<p>Specify an alternative default TLS cipher list. Requires Node.js to be built
with crypto support (default).</p>
<h4><code>--tls-keylog=file</code><span><a class="mark" href="#--tls-keylogfile" id="--tls-keylogfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_keylog_file"></a></h4>
<div class="api_metadata">
<span>Added in: v13.2.0, v12.16.0</span>
</div>
<p>Log TLS key material to a file. The key material is in NSS <code>SSLKEYLOGFILE</code>
format and can be used by software (such as Wireshark) to decrypt the TLS
traffic.</p>
<h4><code>--tls-max-v1.2</code><span><a class="mark" href="#--tls-max-v12" id="--tls-max-v12">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_max_v1_2"></a></h4>
<div class="api_metadata">
<span>Added in: v12.0.0, v10.20.0</span>
</div>
<p>Set <a href="tls.html#tlsdefault_max_version"><code>tls.DEFAULT_MAX_VERSION</code></a> to 'TLSv1.2'. Use to disable support for
TLSv1.3.</p>
<h4><code>--tls-max-v1.3</code><span><a class="mark" href="#--tls-max-v13" id="--tls-max-v13">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_max_v1_3"></a></h4>
<div class="api_metadata">
<span>Added in: v12.0.0</span>
</div>
<p>Set default <a href="tls.html#tlsdefault_max_version"><code>tls.DEFAULT_MAX_VERSION</code></a> to 'TLSv1.3'. Use to enable support
for TLSv1.3.</p>
<h4><code>--tls-min-v1.0</code><span><a class="mark" href="#--tls-min-v10" id="--tls-min-v10">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_min_v1_0"></a></h4>
<div class="api_metadata">
<span>Added in: v12.0.0, v10.20.0</span>
</div>
<p>Set default <a href="tls.html#tlsdefault_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1'. Use for compatibility with
old TLS clients or servers.</p>
<h4><code>--tls-min-v1.1</code><span><a class="mark" href="#--tls-min-v11" id="--tls-min-v11">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_min_v1_1"></a></h4>
<div class="api_metadata">
<span>Added in: v12.0.0, v10.20.0</span>
</div>
<p>Set default <a href="tls.html#tlsdefault_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.1'. Use for compatibility
with old TLS clients or servers.</p>
<h4><code>--tls-min-v1.2</code><span><a class="mark" href="#--tls-min-v12" id="--tls-min-v12">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_min_v1_2"></a></h4>
<div class="api_metadata">
<span>Added in: v12.2.0, v10.20.0</span>
</div>
<p>Set default <a href="tls.html#tlsdefault_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.2'. This is the default for
12.x and later, but the option is supported for compatibility with older Node.js
versions.</p>
<h4><code>--tls-min-v1.3</code><span><a class="mark" href="#--tls-min-v13" id="--tls-min-v13">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_min_v1_3"></a></h4>
<div class="api_metadata">
<span>Added in: v12.0.0</span>
</div>
<p>Set default <a href="tls.html#tlsdefault_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.3'. Use to disable support
for TLSv1.2, which is not as secure as TLSv1.3.</p>
<h4><code>--trace-atomics-wait</code><span><a class="mark" href="#--trace-atomics-wait" id="--trace-atomics-wait">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_atomics_wait"></a></h4>
<div class="api_metadata">
<span>Added in: v14.3.0</span><span>Deprecated since: v18.8.0, v16.18.0</span>
</div>
<p></p><div class="api_stability api_stability_0"><a href="documentation.html#stability-index">Stability: 0</a> - Deprecated</div><p></p>
<p>Print short summaries of calls to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait"><code>Atomics.wait()</code></a> to stderr.
The output could look like this:</p>
<pre><code class="language-text">(node:15701) [Thread 0] Atomics.wait(&lt;address> + 0, 1, inf) started
(node:15701) [Thread 0] Atomics.wait(&lt;address> + 0, 1, inf) did not wait because the values mismatched
(node:15701) [Thread 0] Atomics.wait(&lt;address> + 0, 0, 10) started
(node:15701) [Thread 0] Atomics.wait(&lt;address> + 0, 0, 10) timed out
(node:15701) [Thread 0] Atomics.wait(&lt;address> + 4, 0, inf) started
(node:15701) [Thread 1] Atomics.wait(&lt;address> + 4, -1, inf) started
(node:15701) [Thread 0] Atomics.wait(&lt;address> + 4, 0, inf) was woken up by another thread
(node:15701) [Thread 1] Atomics.wait(&lt;address> + 4, -1, inf) was woken up by another thread</code> <button class="copy-button">copy</button></pre>
<p>The fields here correspond to:</p>
<ul>
<li>The thread id as given by <a href="worker_threads.html#workerthreadid"><code>worker_threads.threadId</code></a></li>
<li>The base address of the <code>SharedArrayBuffer</code> in question, as well as the
byte offset corresponding to the index passed to <code>Atomics.wait()</code></li>
<li>The expected value that was passed to <code>Atomics.wait()</code></li>
<li>The timeout passed to <code>Atomics.wait</code></li>
</ul>
<h4><code>--trace-deprecation</code><span><a class="mark" href="#--trace-deprecation" id="--trace-deprecation">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_deprecation"></a></h4>
<div class="api_metadata">
<span>Added in: v0.8.0</span>
</div>
<p>Print stack traces for deprecations.</p>
<h4><code>--trace-env</code><span><a class="mark" href="#--trace-env" id="--trace-env">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_env"></a></h4>
<div class="api_metadata">
<span>Added in: v22.13.0</span>
</div>
<p>Print information about any access to environment variables done in the current Node.js
instance to stderr, including:</p>
<ul>
<li>The environment variable reads that Node.js does internally.</li>
<li>Writes in the form of <code>process.env.KEY = "SOME VALUE"</code>.</li>
<li>Reads in the form of <code>process.env.KEY</code>.</li>
<li>Definitions in the form of <code>Object.defineProperty(process.env, 'KEY', {...})</code>.</li>
<li>Queries in the form of <code>Object.hasOwn(process.env, 'KEY')</code>,
<code>process.env.hasOwnProperty('KEY')</code> or <code>'KEY' in process.env</code>.</li>
<li>Deletions in the form of <code>delete process.env.KEY</code>.</li>
<li>Enumerations inf the form of <code>...process.env</code> or <code>Object.keys(process.env)</code>.</li>
</ul>
<p>Only the names of the environment variables being accessed are printed. The values are not printed.</p>
<p>To print the stack trace of the access, use <code>--trace-env-js-stack</code> and/or
<code>--trace-env-native-stack</code>.</p>
<h4><code>--trace-env-js-stack</code><span><a class="mark" href="#--trace-env-js-stack" id="--trace-env-js-stack">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_env_js_stack"></a></h4>
<div class="api_metadata">
<span>Added in: v22.13.0</span>
</div>
<p>In addition to what <code>--trace-env</code> does, this prints the JavaScript stack trace of the access.</p>
<h4><code>--trace-env-native-stack</code><span><a class="mark" href="#--trace-env-native-stack" id="--trace-env-native-stack">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_env_native_stack"></a></h4>
<div class="api_metadata">
<span>Added in: v22.13.0</span>
</div>
<p>In addition to what <code>--trace-env</code> does, this prints the native stack trace of the access.</p>
<h4><code>--trace-event-categories</code><span><a class="mark" href="#--trace-event-categories" id="--trace-event-categories">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_event_categories"></a></h4>
<div class="api_metadata">
<span>Added in: v7.7.0</span>
</div>
<p>A comma separated list of categories that should be traced when trace event
tracing is enabled using <code>--trace-events-enabled</code>.</p>
<h4><code>--trace-event-file-pattern</code><span><a class="mark" href="#--trace-event-file-pattern" id="--trace-event-file-pattern">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_event_file_pattern"></a></h4>
<div class="api_metadata">
<span>Added in: v9.8.0</span>
</div>
<p>Template string specifying the filepath for the trace event data, it
supports <code>${rotation}</code> and <code>${pid}</code>.</p>
<h4><code>--trace-events-enabled</code><span><a class="mark" href="#--trace-events-enabled" id="--trace-events-enabled">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_events_enabled"></a></h4>
<div class="api_metadata">
<span>Added in: v7.7.0</span>
</div>
<p>Enables the collection of trace event tracing information.</p>
<h4><code>--trace-exit</code><span><a class="mark" href="#--trace-exit" id="--trace-exit">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_exit"></a></h4>
<div class="api_metadata">
<span>Added in: v13.5.0, v12.16.0</span>
</div>
<p>Prints a stack trace whenever an environment is exited proactively,
i.e. invoking <code>process.exit()</code>.</p>
<h4><code>--trace-require-module=mode</code><span><a class="mark" href="#--trace-require-modulemode" id="--trace-require-modulemode">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_require_module_mode"></a></h4>
<div class="api_metadata">
<span>Added in: v22.13.0</span>
</div>
<p>Prints information about usage of <a href="modules.html#loading-ecmascript-modules-using-require">Loading ECMAScript modules using <code>require()</code></a>.</p>
<p>When <code>mode</code> is <code>all</code>, all usage is printed. When <code>mode</code> is <code>no-node-modules</code>, usage
from the <code>node_modules</code> folder is excluded.</p>
<h4><code>--trace-sigint</code><span><a class="mark" href="#--trace-sigint" id="--trace-sigint">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_sigint"></a></h4>
<div class="api_metadata">
<span>Added in: v13.9.0, v12.17.0</span>
</div>
<p>Prints a stack trace on SIGINT.</p>
<h4><code>--trace-sync-io</code><span><a class="mark" href="#--trace-sync-io" id="--trace-sync-io">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_sync_io"></a></h4>
<div class="api_metadata">
<span>Added in: v2.1.0</span>
</div>
<p>Prints a stack trace whenever synchronous I/O is detected after the first turn
of the event loop.</p>
<h4><code>--trace-tls</code><span><a class="mark" href="#--trace-tls" id="--trace-tls">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_tls"></a></h4>
<div class="api_metadata">
<span>Added in: v12.2.0</span>
</div>
<p>Prints TLS packet trace information to <code>stderr</code>. This can be used to debug TLS
connection problems.</p>
<h4><code>--trace-uncaught</code><span><a class="mark" href="#--trace-uncaught" id="--trace-uncaught">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_uncaught"></a></h4>
<div class="api_metadata">
<span>Added in: v13.1.0</span>
</div>
<p>Print stack traces for uncaught exceptions; usually, the stack trace associated
with the creation of an <code>Error</code> is printed, whereas this makes Node.js also
print the stack trace associated with throwing the value (which does not need
to be an <code>Error</code> instance).</p>
<p>Enabling this option may affect garbage collection behavior negatively.</p>
<h4><code>--trace-warnings</code><span><a class="mark" href="#--trace-warnings" id="--trace-warnings">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_warnings"></a></h4>
<div class="api_metadata">
<span>Added in: v6.0.0</span>
</div>
<p>Print stack traces for process warnings (including deprecations).</p>
<h4><code>--track-heap-objects</code><span><a class="mark" href="#--track-heap-objects" id="--track-heap-objects">#</a></span><a aria-hidden="true" class="legacy" id="cli_track_heap_objects"></a></h4>
<div class="api_metadata">
<span>Added in: v2.4.0</span>
</div>
<p>Track heap object allocations for heap snapshots.</p>
<h4><code>--unhandled-rejections=mode</code><span><a class="mark" href="#--unhandled-rejectionsmode" id="--unhandled-rejectionsmode">#</a></span><a aria-hidden="true" class="legacy" id="cli_unhandled_rejections_mode"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v15.0.0</td>
<td><p>Changed default mode to <code>throw</code>. Previously, a warning was emitted.</p></td></tr>
<tr><td>v12.0.0, v10.17.0</td>
<td><p><span>Added in: v12.0.0, v10.17.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Using this flag allows to change what should happen when an unhandled rejection
occurs. One of the following modes can be chosen:</p>
<ul>
<li><code>throw</code>: Emit <a href="process.html#event-unhandledrejection"><code>unhandledRejection</code></a>. If this hook is not set, raise the
unhandled rejection as an uncaught exception. This is the default.</li>
<li><code>strict</code>: Raise the unhandled rejection as an uncaught exception. If the
exception is handled, <a href="process.html#event-unhandledrejection"><code>unhandledRejection</code></a> is emitted.</li>
<li><code>warn</code>: Always trigger a warning, no matter if the <a href="process.html#event-unhandledrejection"><code>unhandledRejection</code></a>
hook is set or not but do not print the deprecation warning.</li>
<li><code>warn-with-error-code</code>: Emit <a href="process.html#event-unhandledrejection"><code>unhandledRejection</code></a>. If this hook is not
set, trigger a warning, and set the process exit code to 1.</li>
<li><code>none</code>: Silence all warnings.</li>
</ul>
<p>If a rejection happens during the command line entry point's ES module static
loading phase, it will always raise it as an uncaught exception.</p>
<h4><code>--use-bundled-ca</code>, <code>--use-openssl-ca</code><span><a class="mark" href="#--use-bundled-ca---use-openssl-ca" id="--use-bundled-ca---use-openssl-ca">#</a></span><a aria-hidden="true" class="legacy" id="cli_use_bundled_ca_use_openssl_ca"></a></h4>
<div class="api_metadata">
<span>Added in: v6.11.0</span>
</div>
<p>Use bundled Mozilla CA store as supplied by current Node.js version
or use OpenSSL's default CA store. The default store is selectable
at build-time.</p>
<p>The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store
that is fixed at release time. It is identical on all supported platforms.</p>
<p>Using OpenSSL store allows for external modifications of the store. For most
Linux and BSD distributions, this store is maintained by the distribution
maintainers and system administrators. OpenSSL CA store location is dependent on
configuration of the OpenSSL library but this can be altered at runtime using
environment variables.</p>
<p>See <code>SSL_CERT_DIR</code> and <code>SSL_CERT_FILE</code>.</p>
<h4><code>--use-largepages=mode</code><span><a class="mark" href="#--use-largepagesmode" id="--use-largepagesmode">#</a></span><a aria-hidden="true" class="legacy" id="cli_use_largepages_mode"></a></h4>
<div class="api_metadata">
<span>Added in: v13.6.0, v12.17.0</span>
</div>
<p>Re-map the Node.js static code to large memory pages at startup. If supported on
the target system, this will cause the Node.js static code to be moved onto 2
MiB pages instead of 4 KiB pages.</p>
<p>The following values are valid for <code>mode</code>:</p>
<ul>
<li><code>off</code>: No mapping will be attempted. This is the default.</li>
<li><code>on</code>: If supported by the OS, mapping will be attempted. Failure to map will
be ignored and a message will be printed to standard error.</li>
<li><code>silent</code>: If supported by the OS, mapping will be attempted. Failure to map
will be ignored and will not be reported.</li>
</ul>
<h4><code>--v8-options</code><span><a class="mark" href="#--v8-options" id="--v8-options">#</a></span><a aria-hidden="true" class="legacy" id="cli_v8_options"></a></h4>
<div class="api_metadata">
<span>Added in: v0.1.3</span>
</div>
<p>Print V8 command-line options.</p>
<h4><code>--v8-pool-size=num</code><span><a class="mark" href="#--v8-pool-sizenum" id="--v8-pool-sizenum">#</a></span><a aria-hidden="true" class="legacy" id="cli_v8_pool_size_num"></a></h4>
<div class="api_metadata">
<span>Added in: v5.10.0</span>
</div>
<p>Set V8's thread pool size which will be used to allocate background jobs.</p>
<p>If set to <code>0</code> then Node.js will choose an appropriate size of the thread pool
based on an estimate of the amount of parallelism.</p>
<p>The amount of parallelism refers to the number of computations that can be
carried out simultaneously in a given machine. In general, it's the same as the
amount of CPUs, but it may diverge in environments such as VMs or containers.</p>
<h4><code>-v</code>, <code>--version</code><span><a class="mark" href="#-v---version" id="-v---version">#</a></span><a aria-hidden="true" class="legacy" id="cli_v_version"></a></h4>
<div class="api_metadata">
<span>Added in: v0.1.3</span>
</div>
<p>Print node's version.</p>
<h4><code>--watch</code><span><a class="mark" href="#--watch" id="--watch">#</a></span><a aria-hidden="true" class="legacy" id="cli_watch"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.0.0</td>
<td><p>Watch mode is now stable.</p></td></tr>
<tr><td>v19.2.0, v18.13.0</td>
<td><p>Test runner now supports running in watch mode.</p></td></tr>
<tr><td>v18.11.0, v16.19.0</td>
<td><p><span>Added in: v18.11.0, v16.19.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Starts Node.js in watch mode.
When in watch mode, changes in the watched files cause the Node.js process to
restart.
By default, watch mode will watch the entry point
and any required or imported module.
Use <code>--watch-path</code> to specify what paths to watch.</p>
<p>This flag cannot be combined with
<code>--check</code>, <code>--eval</code>, <code>--interactive</code>, or the REPL.</p>
<pre><code class="language-bash">node --watch index.js</code> <button class="copy-button">copy</button></pre>
<h4><code>--watch-path</code><span><a class="mark" href="#--watch-path" id="--watch-path">#</a></span><a aria-hidden="true" class="legacy" id="cli_watch_path"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.0.0</td>
<td><p>Watch mode is now stable.</p></td></tr>
<tr><td>v18.11.0, v16.19.0</td>
<td><p><span>Added in: v18.11.0, v16.19.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Starts Node.js in watch mode and specifies what paths to watch.
When in watch mode, changes in the watched paths cause the Node.js process to
restart.
This will turn off watching of required or imported modules, even when used in
combination with <code>--watch</code>.</p>
<p>This flag cannot be combined with
<code>--check</code>, <code>--eval</code>, <code>--interactive</code>, <code>--test</code>, or the REPL.</p>
<pre><code class="language-bash">node --watch-path=./src --watch-path=./tests index.js</code> <button class="copy-button">copy</button></pre>
<p>This option is only supported on macOS and Windows.
An <code>ERR_FEATURE_UNAVAILABLE_ON_PLATFORM</code> exception will be thrown
when the option is used on a platform that does not support it.</p>
<h4><code>--watch-preserve-output</code><span><a class="mark" href="#--watch-preserve-output" id="--watch-preserve-output">#</a></span><a aria-hidden="true" class="legacy" id="cli_watch_preserve_output"></a></h4>
<div class="api_metadata">
<span>Added in: v19.3.0, v18.13.0</span>
</div>
<p>Disable the clearing of the console when watch mode restarts the process.</p>
<pre><code class="language-bash">node --watch --watch-preserve-output test.js</code> <button class="copy-button">copy</button></pre>
<h4><code>--zero-fill-buffers</code><span><a class="mark" href="#--zero-fill-buffers" id="--zero-fill-buffers">#</a></span><a aria-hidden="true" class="legacy" id="cli_zero_fill_buffers"></a></h4>
<div class="api_metadata">
<span>Added in: v6.0.0</span>
</div>
<p>Automatically zero-fills all newly allocated <a href="buffer.html#class-buffer"><code>Buffer</code></a> and <a href="buffer.html#class-slowbuffer"><code>SlowBuffer</code></a>
instances.</p>
</section><section><h3>Environment variables<span><a class="mark" href="#environment-variables_1" id="environment-variables_1">#</a></span><a aria-hidden="true" class="legacy" id="cli_environment_variables_1"></a></h3>
<h4><code>FORCE_COLOR=[1, 2, 3]</code><span><a class="mark" href="#force_color1-2-3" id="force_color1-2-3">#</a></span><a aria-hidden="true" class="legacy" id="cli_force_color_1_2_3"></a></h4>
<p>The <code>FORCE_COLOR</code> environment variable is used to
enable ANSI colorized output. The value may be:</p>
<ul>
<li><code>1</code>, <code>true</code>, or the empty string <code>''</code> indicate 16-color support,</li>
<li><code>2</code> to indicate 256-color support, or</li>
<li><code>3</code> to indicate 16 million-color support.</li>
</ul>
<p>When <code>FORCE_COLOR</code> is used and set to a supported value, both the <code>NO_COLOR</code>,
and <code>NODE_DISABLE_COLORS</code> environment variables are ignored.</p>
<p>Any other value will result in colorized output being disabled.</p>
<h4><code>NODE_COMPILE_CACHE=dir</code><span><a class="mark" href="#node_compile_cachedir" id="node_compile_cachedir">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_compile_cache_dir"></a></h4>
<div class="api_metadata">
<span>Added in: v22.1.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active Development</div><p></p>
<p>Enable the <a href="module.html#module-compile-cache">module compile cache</a> for the Node.js instance. See the documentation of
<a href="module.html#module-compile-cache">module compile cache</a> for details.</p>
<h4><code>NODE_DEBUG=module[,…]</code><span><a class="mark" href="#node_debugmodule" id="node_debugmodule">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_debug_module"></a></h4>
<div class="api_metadata">
<span>Added in: v0.1.32</span>
</div>
<p><code>','</code>-separated list of core modules that should print debug information.</p>
<h4><code>NODE_DEBUG_NATIVE=module[,…]</code><span><a class="mark" href="#node_debug_nativemodule" id="node_debug_nativemodule">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_debug_native_module"></a></h4>
<p><code>','</code>-separated list of core C++ modules that should print debug information.</p>
<h4><code>NODE_DISABLE_COLORS=1</code><span><a class="mark" href="#node_disable_colors1" id="node_disable_colors1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_disable_colors_1"></a></h4>
<div class="api_metadata">
<span>Added in: v0.3.0</span>
</div>
<p>When set, colors will not be used in the REPL.</p>
<h4><code>NODE_DISABLE_COMPILE_CACHE=1</code><span><a class="mark" href="#node_disable_compile_cache1" id="node_disable_compile_cache1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_disable_compile_cache_1"></a></h4>
<div class="api_metadata">
<span>Added in: v22.8.0</span>
</div>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.1 - Active Development</div><p></p>
<p>Disable the <a href="module.html#module-compile-cache">module compile cache</a> for the Node.js instance. See the documentation of
<a href="module.html#module-compile-cache">module compile cache</a> for details.</p>
<h4><code>NODE_EXTRA_CA_CERTS=file</code><span><a class="mark" href="#node_extra_ca_certsfile" id="node_extra_ca_certsfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_extra_ca_certs_file"></a></h4>
<div class="api_metadata">
<span>Added in: v7.3.0</span>
</div>
<p>When set, the well known "root" CAs (like VeriSign) will be extended with the
extra certificates in <code>file</code>. The file should consist of one or more trusted
certificates in PEM format. A message will be emitted (once) with
<a href="process.html#processemitwarningwarning-options"><code>process.emitWarning()</code></a> if the file is missing or
malformed, but any errors are otherwise ignored.</p>
<p>Neither the well known nor extra certificates are used when the <code>ca</code>
options property is explicitly specified for a TLS or HTTPS client or server.</p>
<p>This environment variable is ignored when <code>node</code> runs as setuid root or
has Linux file capabilities set.</p>
<p>The <code>NODE_EXTRA_CA_CERTS</code> environment variable is only read when the Node.js
process is first launched. Changing the value at runtime using
<code>process.env.NODE_EXTRA_CA_CERTS</code> has no effect on the current process.</p>
<h4><code>NODE_ICU_DATA=file</code><span><a class="mark" href="#node_icu_datafile" id="node_icu_datafile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_icu_data_file"></a></h4>
<div class="api_metadata">
<span>Added in: v0.11.15</span>
</div>
<p>Data path for ICU (<code>Intl</code> object) data. Will extend linked-in data when compiled
with small-icu support.</p>
<h4><code>NODE_NO_WARNINGS=1</code><span><a class="mark" href="#node_no_warnings1" id="node_no_warnings1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_no_warnings_1"></a></h4>
<div class="api_metadata">
<span>Added in: v6.11.0</span>
</div>
<p>When set to <code>1</code>, process warnings are silenced.</p>
<h4><code>NODE_OPTIONS=options...</code><span><a class="mark" href="#node_optionsoptions" id="node_optionsoptions">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_options_options"></a></h4>
<div class="api_metadata">
<span>Added in: v8.0.0</span>
</div>
<p>A space-separated list of command-line options. <code>options...</code> are interpreted
before command-line options, so command-line options will override or
compound after anything in <code>options...</code>. Node.js will exit with an error if
an option that is not allowed in the environment is used, such as <code>-p</code> or a
script file.</p>
<p>If an option value contains a space, it can be escaped using double quotes:</p>
<pre><code class="language-bash">NODE_OPTIONS=<span class="hljs-string">'--require "./my path/file.js"'</span></code> <button class="copy-button">copy</button></pre>
<p>A singleton flag passed as a command-line option will override the same flag
passed into <code>NODE_OPTIONS</code>:</p>
<pre><code class="language-bash"><span class="hljs-comment"># The inspector will be available on port 5555</span>
NODE_OPTIONS=<span class="hljs-string">'--inspect=localhost:4444'</span> node --inspect=localhost:5555</code> <button class="copy-button">copy</button></pre>
<p>A flag that can be passed multiple times will be treated as if its
<code>NODE_OPTIONS</code> instances were passed first, and then its command-line
instances afterwards:</p>
<pre><code class="language-bash">NODE_OPTIONS=<span class="hljs-string">'--require "./a.js"'</span> node --require <span class="hljs-string">"./b.js"</span>
<span class="hljs-comment"># is equivalent to:</span>
node --require <span class="hljs-string">"./a.js"</span> --require <span class="hljs-string">"./b.js"</span></code> <button class="copy-button">copy</button></pre>
<p>Node.js options that are allowed are in the following list. If an option
supports both --XX and --no-XX variants, they are both supported but only
one is included in the list below.</p>
<!-- node-options-node start -->
<ul>
<li><code>--allow-addons</code></li>
<li><code>--allow-child-process</code></li>
<li><code>--allow-fs-read</code></li>
<li><code>--allow-fs-write</code></li>
<li><code>--allow-wasi</code></li>
<li><code>--allow-worker</code></li>
<li><code>--conditions</code>, <code>-C</code></li>
<li><code>--diagnostic-dir</code></li>
<li><code>--disable-proto</code></li>
<li><code>--disable-sigusr1</code></li>
<li><code>--disable-warning</code></li>
<li><code>--disable-wasm-trap-handler</code></li>
<li><code>--dns-result-order</code></li>
<li><code>--enable-fips</code></li>
<li><code>--enable-network-family-autoselection</code></li>
<li><code>--enable-source-maps</code></li>
<li><code>--entry-url</code></li>
<li><code>--experimental-abortcontroller</code></li>
<li><code>--experimental-async-context-frame</code></li>
<li><code>--experimental-default-type</code></li>
<li><code>--experimental-detect-module</code></li>
<li><code>--experimental-eventsource</code></li>
<li><code>--experimental-import-meta-resolve</code></li>
<li><code>--experimental-json-modules</code></li>
<li><code>--experimental-loader</code></li>
<li><code>--experimental-modules</code></li>
<li><code>--experimental-permission</code></li>
<li><code>--experimental-print-required-tla</code></li>
<li><code>--experimental-require-module</code></li>
<li><code>--experimental-shadow-realm</code></li>
<li><code>--experimental-specifier-resolution</code></li>
<li><code>--experimental-strip-types</code></li>
<li><code>--experimental-top-level-await</code></li>
<li><code>--experimental-transform-types</code></li>
<li><code>--experimental-vm-modules</code></li>
<li><code>--experimental-wasi-unstable-preview1</code></li>
<li><code>--experimental-wasm-modules</code></li>
<li><code>--experimental-webstorage</code></li>
<li><code>--force-context-aware</code></li>
<li><code>--force-fips</code></li>
<li><code>--force-node-api-uncaught-exceptions-policy</code></li>
<li><code>--frozen-intrinsics</code></li>
<li><code>--heap-prof-dir</code></li>
<li><code>--heap-prof-interval</code></li>
<li><code>--heap-prof-name</code></li>
<li><code>--heap-prof</code></li>
<li><code>--heapsnapshot-near-heap-limit</code></li>
<li><code>--heapsnapshot-signal</code></li>
<li><code>--http-parser</code></li>
<li><code>--icu-data-dir</code></li>
<li><code>--import</code></li>
<li><code>--input-type</code></li>
<li><code>--insecure-http-parser</code></li>
<li><code>--inspect-brk</code></li>
<li><code>--inspect-port</code>, <code>--debug-port</code></li>
<li><code>--inspect-publish-uid</code></li>
<li><code>--inspect-wait</code></li>
<li><code>--inspect</code></li>
<li><code>--localstorage-file</code></li>
<li><code>--max-http-header-size</code></li>
<li><code>--napi-modules</code></li>
<li><code>--network-family-autoselection-attempt-timeout</code></li>
<li><code>--no-addons</code></li>
<li><code>--no-deprecation</code></li>
<li><code>--no-experimental-fetch</code></li>
<li><code>--no-experimental-global-customevent</code></li>
<li><code>--no-experimental-global-navigator</code></li>
<li><code>--no-experimental-global-webcrypto</code></li>
<li><code>--no-experimental-repl-await</code></li>
<li><code>--no-experimental-sqlite</code></li>
<li><code>--no-experimental-websocket</code></li>
<li><code>--no-extra-info-on-fatal-exception</code></li>
<li><code>--no-force-async-hooks-checks</code></li>
<li><code>--no-global-search-paths</code></li>
<li><code>--no-network-family-autoselection</code></li>
<li><code>--no-warnings</code></li>
<li><code>--node-memory-debug</code></li>
<li><code>--openssl-config</code></li>
<li><code>--openssl-legacy-provider</code></li>
<li><code>--openssl-shared-config</code></li>
<li><code>--pending-deprecation</code></li>
<li><code>--permission</code></li>
<li><code>--preserve-symlinks-main</code></li>
<li><code>--preserve-symlinks</code></li>
<li><code>--prof-process</code></li>
<li><code>--redirect-warnings</code></li>
<li><code>--report-compact</code></li>
<li><code>--report-dir</code>, <code>--report-directory</code></li>
<li><code>--report-exclude-env</code></li>
<li><code>--report-exclude-network</code></li>
<li><code>--report-filename</code></li>
<li><code>--report-on-fatalerror</code></li>
<li><code>--report-on-signal</code></li>
<li><code>--report-signal</code></li>
<li><code>--report-uncaught-exception</code></li>
<li><code>--require</code>, <code>-r</code></li>
<li><code>--secure-heap-min</code></li>
<li><code>--secure-heap</code></li>
<li><code>--snapshot-blob</code></li>
<li><code>--test-coverage-branches</code></li>
<li><code>--test-coverage-exclude</code></li>
<li><code>--test-coverage-functions</code></li>
<li><code>--test-coverage-include</code></li>
<li><code>--test-coverage-lines</code></li>
<li><code>--test-name-pattern</code></li>
<li><code>--test-only</code></li>
<li><code>--test-reporter-destination</code></li>
<li><code>--test-reporter</code></li>
<li><code>--test-shard</code></li>
<li><code>--test-skip-pattern</code></li>
<li><code>--throw-deprecation</code></li>
<li><code>--title</code></li>
<li><code>--tls-cipher-list</code></li>
<li><code>--tls-keylog</code></li>
<li><code>--tls-max-v1.2</code></li>
<li><code>--tls-max-v1.3</code></li>
<li><code>--tls-min-v1.0</code></li>
<li><code>--tls-min-v1.1</code></li>
<li><code>--tls-min-v1.2</code></li>
<li><code>--tls-min-v1.3</code></li>
<li><code>--trace-atomics-wait</code></li>
<li><code>--trace-deprecation</code></li>
<li><code>--trace-env-js-stack</code></li>
<li><code>--trace-env-native-stack</code></li>
<li><code>--trace-env</code></li>
<li><code>--trace-event-categories</code></li>
<li><code>--trace-event-file-pattern</code></li>
<li><code>--trace-events-enabled</code></li>
<li><code>--trace-exit</code></li>
<li><code>--trace-require-module</code></li>
<li><code>--trace-sigint</code></li>
<li><code>--trace-sync-io</code></li>
<li><code>--trace-tls</code></li>
<li><code>--trace-uncaught</code></li>
<li><code>--trace-warnings</code></li>
<li><code>--track-heap-objects</code></li>
<li><code>--unhandled-rejections</code></li>
<li><code>--use-bundled-ca</code></li>
<li><code>--use-largepages</code></li>
<li><code>--use-openssl-ca</code></li>
<li><code>--v8-pool-size</code></li>
<li><code>--watch-path</code></li>
<li><code>--watch-preserve-output</code></li>
<li><code>--watch</code></li>
<li><code>--zero-fill-buffers</code></li>
</ul>
<!-- node-options-node end -->
<p>V8 options that are allowed are:</p>
<!-- node-options-v8 start -->
<ul>
<li><code>--abort-on-uncaught-exception</code></li>
<li><code>--disallow-code-generation-from-strings</code></li>
<li><code>--enable-etw-stack-walking</code></li>
<li><code>--expose-gc</code></li>
<li><code>--huge-max-old-generation-size</code></li>
<li><code>--interpreted-frames-native-stack</code></li>
<li><code>--jitless</code></li>
<li><code>--max-old-space-size</code></li>
<li><code>--max-semi-space-size</code></li>
<li><code>--perf-basic-prof-only-functions</code></li>
<li><code>--perf-basic-prof</code></li>
<li><code>--perf-prof-unwinding-info</code></li>
<li><code>--perf-prof</code></li>
<li><code>--stack-trace-limit</code></li>
</ul>
<!-- node-options-v8 end -->
<!-- node-options-others start -->
<p><code>--perf-basic-prof-only-functions</code>, <code>--perf-basic-prof</code>,
<code>--perf-prof-unwinding-info</code>, and <code>--perf-prof</code> are only available on Linux.</p>
<p><code>--enable-etw-stack-walking</code> is only available on Windows.</p>
<!-- node-options-others end -->
<h4><code>NODE_PATH=path[:…]</code><span><a class="mark" href="#node_pathpath" id="node_pathpath">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_path_path"></a></h4>
<div class="api_metadata">
<span>Added in: v0.1.32</span>
</div>
<p><code>':'</code>-separated list of directories prefixed to the module search path.</p>
<p>On Windows, this is a <code>';'</code>-separated list instead.</p>
<h4><code>NODE_PENDING_DEPRECATION=1</code><span><a class="mark" href="#node_pending_deprecation1" id="node_pending_deprecation1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_pending_deprecation_1"></a></h4>
<div class="api_metadata">
<span>Added in: v8.0.0</span>
</div>
<p>When set to <code>1</code>, emit pending deprecation warnings.</p>
<p>Pending deprecations are generally identical to a runtime deprecation with the
notable exception that they are turned <em>off</em> by default and will not be emitted
unless either the <code>--pending-deprecation</code> command-line flag, or the
<code>NODE_PENDING_DEPRECATION=1</code> environment variable, is set. Pending deprecations
are used to provide a kind of selective "early warning" mechanism that
developers may leverage to detect deprecated API usage.</p>
<h4><code>NODE_PENDING_PIPE_INSTANCES=instances</code><span><a class="mark" href="#node_pending_pipe_instancesinstances" id="node_pending_pipe_instancesinstances">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_pending_pipe_instances_instances"></a></h4>
<p>Set the number of pending pipe instance handles when the pipe server is waiting
for connections. This setting applies to Windows only.</p>
<h4><code>NODE_PRESERVE_SYMLINKS=1</code><span><a class="mark" href="#node_preserve_symlinks1" id="node_preserve_symlinks1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_preserve_symlinks_1"></a></h4>
<div class="api_metadata">
<span>Added in: v7.1.0</span>
</div>
<p>When set to <code>1</code>, instructs the module loader to preserve symbolic links when
resolving and caching modules.</p>
<h4><code>NODE_REDIRECT_WARNINGS=file</code><span><a class="mark" href="#node_redirect_warningsfile" id="node_redirect_warningsfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_redirect_warnings_file"></a></h4>
<div class="api_metadata">
<span>Added in: v8.0.0</span>
</div>
<p>When set, process warnings will be emitted to the given file instead of
printing to stderr. The file will be created if it does not exist, and will be
appended to if it does. If an error occurs while attempting to write the
warning to the file, the warning will be written to stderr instead. This is
equivalent to using the <code>--redirect-warnings=file</code> command-line flag.</p>
<h4><code>NODE_REPL_EXTERNAL_MODULE=file</code><span><a class="mark" href="#node_repl_external_modulefile" id="node_repl_external_modulefile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_repl_external_module_file"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v22.3.0</td>
<td><p>Remove the possibility to use this env var with kDisableNodeOptionsEnv for embedders.</p></td></tr>
<tr><td>v13.0.0, v12.16.0</td>
<td><p><span>Added in: v13.0.0, v12.16.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>Path to a Node.js module which will be loaded in place of the built-in REPL.
Overriding this value to an empty string (<code>''</code>) will use the built-in REPL.</p>
<h4><code>NODE_REPL_HISTORY=file</code><span><a class="mark" href="#node_repl_historyfile" id="node_repl_historyfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_repl_history_file"></a></h4>
<div class="api_metadata">
<span>Added in: v3.0.0</span>
</div>
<p>Path to the file used to store the persistent REPL history. The default path is
<code>~/.node_repl_history</code>, which is overridden by this variable. Setting the value
to an empty string (<code>''</code> or <code>' '</code>) disables persistent REPL history.</p>
<h4><code>NODE_SKIP_PLATFORM_CHECK=value</code><span><a class="mark" href="#node_skip_platform_checkvalue" id="node_skip_platform_checkvalue">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_skip_platform_check_value"></a></h4>
<div class="api_metadata">
<span>Added in: v14.5.0</span>
</div>
<p>If <code>value</code> equals <code>'1'</code>, the check for a supported platform is skipped during
Node.js startup. Node.js might not execute correctly. Any issues encountered
on unsupported platforms will not be fixed.</p>
<h4><code>NODE_TEST_CONTEXT=value</code><span><a class="mark" href="#node_test_contextvalue" id="node_test_contextvalue">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_test_context_value"></a></h4>
<p>If <code>value</code> equals <code>'child'</code>, test reporter options will be overridden and test
output will be sent to stdout in the TAP format. If any other value is provided,
Node.js makes no guarantees about the reporter format used or its stability.</p>
<h4><code>NODE_TLS_REJECT_UNAUTHORIZED=value</code><span><a class="mark" href="#node_tls_reject_unauthorizedvalue" id="node_tls_reject_unauthorizedvalue">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_tls_reject_unauthorized_value"></a></h4>
<p>If <code>value</code> equals <code>'0'</code>, certificate validation is disabled for TLS connections.
This makes TLS, and HTTPS by extension, insecure. The use of this environment
variable is strongly discouraged.</p>
<h4><code>NODE_V8_COVERAGE=dir</code><span><a class="mark" href="#node_v8_coveragedir" id="node_v8_coveragedir">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_v8_coverage_dir"></a></h4>
<p>When set, Node.js will begin outputting <a href="https://v8project.blogspot.com/2017/12/javascript-code-coverage.html">V8 JavaScript code coverage</a> and
<a href="https://sourcemaps.info/spec.html">Source Map</a> data to the directory provided as an argument (coverage
information is written as JSON to files with a <code>coverage</code> prefix).</p>
<p><code>NODE_V8_COVERAGE</code> will automatically propagate to subprocesses, making it
easier to instrument applications that call the <code>child_process.spawn()</code> family
of functions. <code>NODE_V8_COVERAGE</code> can be set to an empty string, to prevent
propagation.</p>
<h5>Coverage output<span><a class="mark" href="#coverage-output" id="coverage-output">#</a></span><a aria-hidden="true" class="legacy" id="cli_coverage_output"></a></h5>
<p>Coverage is output as an array of <a href="https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage">ScriptCoverage</a> objects on the top-level
key <code>result</code>:</p>
<pre><code class="language-json"><span class="hljs-punctuation">{</span>
<span class="hljs-attr">"result"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-punctuation">{</span>
<span class="hljs-attr">"scriptId"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"67"</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"url"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"internal/tty.js"</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"functions"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span></code> <button class="copy-button">copy</button></pre>
<h5>Source map cache<span><a class="mark" href="#source-map-cache" id="source-map-cache">#</a></span><a aria-hidden="true" class="legacy" id="cli_source_map_cache"></a></h5>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<p>If found, source map data is appended to the top-level key <code>source-map-cache</code>
on the JSON coverage object.</p>
<p><code>source-map-cache</code> is an object with keys representing the files source maps
were extracted from, and values which include the raw source-map URL
(in the key <code>url</code>), the parsed Source Map v3 information (in the key <code>data</code>),
and the line lengths of the source file (in the key <code>lineLengths</code>).</p>
<pre><code class="language-json"><span class="hljs-punctuation">{</span>
<span class="hljs-attr">"result"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-punctuation">{</span>
<span class="hljs-attr">"scriptId"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"68"</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"url"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"file:///absolute/path/to/source.js"</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"functions"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"source-map-cache"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">"file:///absolute/path/to/source.js"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">"url"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"./path-to-map.json"</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"data"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
<span class="hljs-attr">"version"</span><span class="hljs-punctuation">:</span> <span class="hljs-number">3</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"sources"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-string">"file:///absolute/path/to/original.js"</span>
<span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"names"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-string">"Foo"</span><span class="hljs-punctuation">,</span>
<span class="hljs-string">"console"</span><span class="hljs-punctuation">,</span>
<span class="hljs-string">"info"</span>
<span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"mappings"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"MAAMA,IACJC,YAAaC"</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"sourceRoot"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"./"</span>
<span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
<span class="hljs-attr">"lineLengths"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
<span class="hljs-number">13</span><span class="hljs-punctuation">,</span>
<span class="hljs-number">62</span><span class="hljs-punctuation">,</span>
<span class="hljs-number">38</span><span class="hljs-punctuation">,</span>
<span class="hljs-number">27</span>
<span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span></code> <button class="copy-button">copy</button></pre>
<h4><code>NO_COLOR=<any></code><span><a class="mark" href="#no_colorany" id="no_colorany">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_color_any"></a></h4>
<p><a href="https://no-color.org"><code>NO_COLOR</code></a> is an alias for <code>NODE_DISABLE_COLORS</code>. The value of the
environment variable is arbitrary.</p>
<h4><code>OPENSSL_CONF=file</code><span><a class="mark" href="#openssl_conffile" id="openssl_conffile">#</a></span><a aria-hidden="true" class="legacy" id="cli_openssl_conf_file"></a></h4>
<div class="api_metadata">
<span>Added in: v6.11.0</span>
</div>
<p>Load an OpenSSL configuration file on startup. Among other uses, this can be
used to enable FIPS-compliant crypto if Node.js is built with
<code>./configure --openssl-fips</code>.</p>
<p>If the <a href="#--openssl-configfile"><code>--openssl-config</code></a> command-line option is used, the environment
variable is ignored.</p>
<h4><code>SSL_CERT_DIR=dir</code><span><a class="mark" href="#ssl_cert_dirdir" id="ssl_cert_dirdir">#</a></span><a aria-hidden="true" class="legacy" id="cli_ssl_cert_dir_dir"></a></h4>
<div class="api_metadata">
<span>Added in: v7.7.0</span>
</div>
<p>If <code>--use-openssl-ca</code> is enabled, this overrides and sets OpenSSL's directory
containing trusted certificates.</p>
<p>Be aware that unless the child environment is explicitly set, this environment
variable will be inherited by any child processes, and if they use OpenSSL, it
may cause them to trust the same CAs as node.</p>
<h4><code>SSL_CERT_FILE=file</code><span><a class="mark" href="#ssl_cert_filefile" id="ssl_cert_filefile">#</a></span><a aria-hidden="true" class="legacy" id="cli_ssl_cert_file_file"></a></h4>
<div class="api_metadata">
<span>Added in: v7.7.0</span>
</div>
<p>If <code>--use-openssl-ca</code> is enabled, this overrides and sets OpenSSL's file
containing trusted certificates.</p>
<p>Be aware that unless the child environment is explicitly set, this environment
variable will be inherited by any child processes, and if they use OpenSSL, it
may cause them to trust the same CAs as node.</p>
<h4><code>TZ</code><span><a class="mark" href="#tz" id="tz">#</a></span><a aria-hidden="true" class="legacy" id="cli_tz"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v16.2.0</td>
<td><p>Changing the TZ variable using process.env.TZ = changes the timezone on Windows as well.</p></td></tr>
<tr><td>v13.0.0</td>
<td><p>Changing the TZ variable using process.env.TZ = changes the timezone on POSIX systems.</p></td></tr>
<tr><td>v0.0.1</td>
<td><p><span>Added in: v0.0.1</span></p></td></tr>
</tbody></table>
</details>
</div>
<p>The <code>TZ</code> environment variable is used to specify the timezone configuration.</p>
<p>While Node.js does not support all of the various <a href="https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html">ways that <code>TZ</code> is handled in
other environments</a>, it does support basic <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">timezone IDs</a> (such as
<code>'Etc/UTC'</code>, <code>'Europe/Paris'</code>, or <code>'America/New_York'</code>).
It may support a few other abbreviations or aliases, but these are strongly
discouraged and not guaranteed.</p>
<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">TZ=Europe/Dublin node -pe <span class="hljs-string">"new Date().toString()"</span></span>
Wed May 12 2021 20:30:48 GMT+0100 (Irish Standard Time)</code> <button class="copy-button">copy</button></pre>
<h4><code>UV_THREADPOOL_SIZE=size</code><span><a class="mark" href="#uv_threadpool_sizesize" id="uv_threadpool_sizesize">#</a></span><a aria-hidden="true" class="legacy" id="cli_uv_threadpool_size_size"></a></h4>
<p>Set the number of threads used in libuv's threadpool to <code>size</code> threads.</p>
<p>Asynchronous system APIs are used by Node.js whenever possible, but where they
do not exist, libuv's threadpool is used to create asynchronous node APIs based
on synchronous system APIs. Node.js APIs that use the threadpool are:</p>
<ul>
<li>all <code>fs</code> APIs, other than the file watcher APIs and those that are explicitly
synchronous</li>
<li>asynchronous crypto APIs such as <code>crypto.pbkdf2()</code>, <code>crypto.scrypt()</code>,
<code>crypto.randomBytes()</code>, <code>crypto.randomFill()</code>, <code>crypto.generateKeyPair()</code></li>
<li><code>dns.lookup()</code></li>
<li>all <code>zlib</code> APIs, other than those that are explicitly synchronous</li>
</ul>
<p>Because libuv's threadpool has a fixed size, it means that if for whatever
reason any of these APIs takes a long time, other (seemingly unrelated) APIs
that run in libuv's threadpool will experience degraded performance. In order to
mitigate this issue, one potential solution is to increase the size of libuv's
threadpool by setting the <code>'UV_THREADPOOL_SIZE'</code> environment variable to a value
greater than <code>4</code> (its current default value). However, setting this from inside
the process using <code>process.env.UV_THREADPOOL_SIZE=size</code> is not guranteed to work
as the threadpool would have been created as part of the runtime initialisation
much before user code is run. For more information, see the <a href="https://docs.libuv.org/en/latest/threadpool.html">libuv threadpool documentation</a>.</p>
</section><section><h3>Useful V8 options<span><a class="mark" href="#useful-v8-options" id="useful-v8-options">#</a></span><a aria-hidden="true" class="legacy" id="cli_useful_v8_options"></a></h3>
<p>V8 has its own set of CLI options. Any V8 CLI option that is provided to <code>node</code>
will be passed on to V8 to handle. V8's options have <em>no stability guarantee</em>.
The V8 team themselves don't consider them to be part of their formal API,
and reserve the right to change them at any time. Likewise, they are not
covered by the Node.js stability guarantees. Many of the V8
options are of interest only to V8 developers. Despite this, there is a small
set of V8 options that are widely applicable to Node.js, and they are
documented here:</p>
<!-- v8-options start -->
<h4><code>--abort-on-uncaught-exception</code><span><a class="mark" href="#--abort-on-uncaught-exception_1" id="--abort-on-uncaught-exception_1">#</a></span><a aria-hidden="true" class="legacy" id="cli_abort_on_uncaught_exception_1"></a></h4>
<h4><code>--disallow-code-generation-from-strings</code><span><a class="mark" href="#--disallow-code-generation-from-strings_1" id="--disallow-code-generation-from-strings_1">#</a></span><a aria-hidden="true" class="legacy" id="cli_disallow_code_generation_from_strings_1"></a></h4>
<h4><code>--enable-etw-stack-walking</code><span><a class="mark" href="#--enable-etw-stack-walking" id="--enable-etw-stack-walking">#</a></span><a aria-hidden="true" class="legacy" id="cli_enable_etw_stack_walking"></a></h4>
<h4><code>--expose-gc</code><span><a class="mark" href="#--expose-gc_1" id="--expose-gc_1">#</a></span><a aria-hidden="true" class="legacy" id="cli_expose_gc_1"></a></h4>
<h4><code>--harmony-shadow-realm</code><span><a class="mark" href="#--harmony-shadow-realm" id="--harmony-shadow-realm">#</a></span><a aria-hidden="true" class="legacy" id="cli_harmony_shadow_realm"></a></h4>
<h4><code>--huge-max-old-generation-size</code><span><a class="mark" href="#--huge-max-old-generation-size" id="--huge-max-old-generation-size">#</a></span><a aria-hidden="true" class="legacy" id="cli_huge_max_old_generation_size"></a></h4>
<h4><code>--interpreted-frames-native-stack</code><span><a class="mark" href="#--interpreted-frames-native-stack" id="--interpreted-frames-native-stack">#</a></span><a aria-hidden="true" class="legacy" id="cli_interpreted_frames_native_stack"></a></h4>
<h4><code>--jitless</code><span><a class="mark" href="#--jitless_1" id="--jitless_1">#</a></span><a aria-hidden="true" class="legacy" id="cli_jitless_1"></a></h4>
<!-- Anchor to make sure old links find a target -->
<p><a id="--max-old-space-sizesize-in-megabytes"></a></p>
<h4><code>--max-old-space-size=SIZE</code> (in MiB)<span><a class="mark" href="#--max-old-space-sizesize-in-mib" id="--max-old-space-sizesize-in-mib">#</a></span><a aria-hidden="true" class="legacy" id="cli_max_old_space_size_size_in_mib"></a></h4>
<p>Sets the max memory size of V8's old memory section. As memory
consumption approaches the limit, V8 will spend more time on
garbage collection in an effort to free unused memory.</p>
<p>On a machine with 2 GiB of memory, consider setting this to
1536 (1.5 GiB) to leave some memory for other uses and avoid swapping.</p>
<pre><code class="language-bash">node --max-old-space-size=1536 index.js</code> <button class="copy-button">copy</button></pre>
<!-- Anchor to make sure old links find a target -->
<p><a id="--max-semi-space-sizesize-in-megabytes"></a></p>
<h4><code>--max-semi-space-size=SIZE</code> (in MiB)<span><a class="mark" href="#--max-semi-space-sizesize-in-mib" id="--max-semi-space-sizesize-in-mib">#</a></span><a aria-hidden="true" class="legacy" id="cli_max_semi_space_size_size_in_mib"></a></h4>
<p>Sets the maximum <a href="https://www.memorymanagement.org/glossary/s.html#semi.space">semi-space</a> size for V8's <a href="https://v8.dev/blog/orinoco-parallel-scavenger">scavenge garbage collector</a> in
MiB (mebibytes).
Increasing the max size of a semi-space may improve throughput for Node.js at
the cost of more memory consumption.</p>
<p>Since the young generation size of the V8 heap is three times (see
<a href="https://chromium.googlesource.com/v8/v8.git/+/refs/tags/10.3.129/src/heap/heap.cc#328"><code>YoungGenerationSizeFromSemiSpaceSize</code></a> in V8) the size of the semi-space,
an increase of 1 MiB to semi-space applies to each of the three individual
semi-spaces and causes the heap size to increase by 3 MiB. The throughput
improvement depends on your workload (see <a href="https://github.com/nodejs/node/issues/42511">#42511</a>).</p>
<p>The default value depends on the memory limit. For example, on 64-bit systems
with a memory limit of 512 MiB, the max size of a semi-space defaults to 1 MiB.
For memory limits up to and including 2GiB, the default max size of a
semi-space will be less than 16 MiB on 64-bit systems.</p>
<p>To get the best configuration for your application, you should try different
max-semi-space-size values when running benchmarks for your application.</p>
<p>For example, benchmark on a 64-bit systems:</p>
<pre><code class="language-bash"><span class="hljs-keyword">for</span> MiB <span class="hljs-keyword">in</span> 16 32 64 128; <span class="hljs-keyword">do</span>
node --max-semi-space-size=<span class="hljs-variable">$MiB</span> index.js
<span class="hljs-keyword">done</span></code> <button class="copy-button">copy</button></pre>
<h4><code>--perf-basic-prof</code><span><a class="mark" href="#--perf-basic-prof" id="--perf-basic-prof">#</a></span><a aria-hidden="true" class="legacy" id="cli_perf_basic_prof"></a></h4>
<h4><code>--perf-basic-prof-only-functions</code><span><a class="mark" href="#--perf-basic-prof-only-functions" id="--perf-basic-prof-only-functions">#</a></span><a aria-hidden="true" class="legacy" id="cli_perf_basic_prof_only_functions"></a></h4>
<h4><code>--perf-prof</code><span><a class="mark" href="#--perf-prof" id="--perf-prof">#</a></span><a aria-hidden="true" class="legacy" id="cli_perf_prof"></a></h4>
<h4><code>--perf-prof-unwinding-info</code><span><a class="mark" href="#--perf-prof-unwinding-info" id="--perf-prof-unwinding-info">#</a></span><a aria-hidden="true" class="legacy" id="cli_perf_prof_unwinding_info"></a></h4>
<h4><code>--prof</code><span><a class="mark" href="#--prof_1" id="--prof_1">#</a></span><a aria-hidden="true" class="legacy" id="cli_prof_1"></a></h4>
<h4><code>--security-revert</code><span><a class="mark" href="#--security-revert" id="--security-revert">#</a></span><a aria-hidden="true" class="legacy" id="cli_security_revert"></a></h4>
<h4><code>--stack-trace-limit=limit</code><span><a class="mark" href="#--stack-trace-limitlimit" id="--stack-trace-limitlimit">#</a></span><a aria-hidden="true" class="legacy" id="cli_stack_trace_limit_limit"></a></h4>
<p>The maximum number of stack frames to collect in an error's stack trace.
Setting it to 0 disables stack trace collection. The default value is 10.</p>
<pre><code class="language-bash">node --stack-trace-limit=12 -p -e <span class="hljs-string">"Error.stackTraceLimit"</span> <span class="hljs-comment"># prints 12</span></code> <button class="copy-button">copy</button></pre>
<!-- v8-options end --></section>
<!-- API END -->
</div>
</div>
</div>
</body>
</html>
|