Introduction
Node.js can be invoked with a wide range of options to configure the behavior of the v8 engine. This list provides an overview of all the possible options that can be used when starting a Node.js program.
Default and Enabled Options
Some of the options mentioned in this list are disabled by default, while others are enabled. To enable a disabled option, you can run node
and pass the flag, for example node --experimental-extras
. On the other hand, if an option is enabled by default and you want to disable it, you can prepend --no-
to the flag name, for example node --no-harmony-shipping
.
Performance Optimization Options
Some options in this list can be used to optimize performance. Here are a few examples:
--optimize-for-size
: Enables optimizations that favor memory size over execution speed.--max_old_space_size
: Sets the maximum size of the old space in megabytes.--gc_interval
: Specifies the interval for garbage collection.
For more performance optimization recommendations, you can refer to Heroku’s blog.
Feature Enable/Disable Options
Node.js provides options that allow you to enable or disable specific features. These options are useful for trying out new proposed JavaScript features that have been implemented in beta. Here are a few examples:
--harmony-public-fields
: Enables “harmony public fields in class literals”.--harmony-private-fields
: Enables “harmony private fields in class literals”.--harmony-numeric-separator
: Enables “harmony numeric separator between digits”.
Other Notable Options
--use-strict
: Enforces strict mode.--es-staging
: Enables test-worthy harmony features (for internal use only).--harmony
: Enables all completed harmony features.--harmony-shipping
: Enables all shipped harmony features.
Note
The option names in Node.js allow words to be separated by both dashes (-
) or underscores (_
), or a mix of those. On tutorials, you’ll find a mix of both, so it can be confusing. However, there is no difference in usage.
Version
This list was generated using the command node --v8-options
and is relative to Node.js version 11.9.0, the latest version at the time of writing.
Full Option List
Option | Description | Type | Default |
---|---|---|---|
–experimental-extras | enable code compiled in via v8_experimental_extra_library_files | bool | false |
–use-strict | enforce strict mode | bool | false |
–es-staging | enable test-worthy harmony features | for internal use only | bool |
–harmony | enable all completed harmony features | bool | false |
–harmony-shipping | enable all shipped harmony features | bool | true |
–harmony-do-expressions | enable “harmony do-expressions” | in progress | bool |
–harmony-class-fields | enable “harmony fields in class literals” | in progress | bool |
–harmony-static-fields | enable “harmony static fields in class literals” | in progress | bool |
–harmony-await-optimization | enable “harmony await taking 1 tick” | in progress | bool |
–harmony-locale | enable “Intl.Locale” | in progress | bool |
–harmony-intl-list-format | enable “Intl.ListFormat” | in progress | bool |
–harmony-intl-relative-time-format | enable “Intl.RelativeTimeFormat” | in progress | bool |
–harmony-public-fields | enable “harmony public fields in class literals” | bool | false |
–harmony-private-fields | enable “harmony private fields in class literals” | bool | false |
–harmony-numeric-separator | enable “harmony numeric separator between digits” | bool | false |
–harmony-string-matchall | enable “harmony String.prototype.matchAll” | bool | false |
–harmony-global | enable “harmony global” | bool | false |
–harmony-string-trimming | enable “harmony String.prototype.trim{Start,End}” | bool | true |
–harmony-sharedarraybuffer | enable “harmony sharedarraybuffer” | bool | true |
–harmony-function-tostring | enable “harmony Function.prototype.toString” | bool | true |
–harmony-import-meta | enable “harmony import.meta property” | bool | true |
–harmony-bigint | enable “harmony arbitrary precision integers” | bool | true |
–harmony-dynamic-import | enable “harmony dynamic import” | bool | true |
–harmony-array-prototype-values | enable “harmony Array.prototype.values” | bool | true |
–harmony-array-flat | enable “harmony Array.prototype.{flat,flatMap}” | bool | true |
–harmony-symbol-description | enable “harmony Symbol.prototype.description” | bool | true |
–icu-timezone-data | get information about timezones from ICU | bool | true |
–future | Implies all staged features that we want to ship in the not-too-far future | bool | false |
–allocation-site-pretenuring | pretenure with allocation sites | bool | true |
–page-promotion | promote pages based on utilization | bool | true |
–page-promotion-threshold | min percentage of live bytes on a page to enable fast evacuation | int | 70 |
–trace-pretenuring | trace pretenuring decisions of HAllocate instructions | bool | false |
–trace-pretenuring-statistics | trace allocation site pretenuring statistics | bool | false |
–track-fields | track fields with only smi values | bool | true |
–track-double-fields | track fields with double values | bool | true |
–track-heap-object-fields | track fields with heap values | bool | true |
–track-computed-fields | track computed boilerplate fields | bool | true |
–track-field-types | track field types | bool | true |
–trace-block-coverage | trace collected block coverage information | bool | false |
–feedback-normalization | feed back normalization to constructors | bool | false |
–optimize-for-size | Enables optimizations which favor memory size over execution speed | bool | false |
–enable-one-shot-optimization | Enable size optimizations for the code that will only be executed once | bool | true |
–unbox-double-arrays | automatically unbox arrays of doubles | bool | true |
–interrupt-budget | interrupt budget which should be used for the profiler counter | int | 147456 |
–ignition-elide-noneffectful-bytecodes | elide bytecodes which won’t have any external effect | bool | true |
–ignition-reo | use ignition register equivalence optimizer | bool | true |
–ignition-filter-expression-positions | filter expression positions before the bytecode pipeline | bool | true |
–ignition-share-named-property-feedback | share feedback slots when loading the same named property from the same object | bool | true |
–print-bytecode | print bytecode generated by ignition interpreter | bool | false |
–print-bytecode-filter | filter for selecting which functions to print bytecode | string | * |
–trace-ignition-codegen | trace the codegen of ignition interpreter bytecode handlers | bool | false |
–trace-ignition-dispatches | traces the dispatches to bytecode handlers by the ignition interpreter | bool | false |
–trace-ignition-dispatches-output-file | the file to which the bytecode handler dispatch table is written | by default, the table is not written to a file | string |
–fast-math | faster | but maybe less accurate math functions | bool |
–trace-track-allocation-sites | trace the tracking of allocation sites | bool | false |
–trace-migration | trace object migration | bool | false |
–trace-generalization | trace map generalization | bool | false |
–concurrent-recompilation | optimizing hot functions asynchronously on a separate thread | bool | true |
–trace-concurrent-recompilation | track concurrent recompilation | bool | false |
–concurrent-recompilation-queue-length | the length of the concurrent compilation queue | int | 8 |
–concurrent-recompilation-delay | artificial compilation delay in ms | int | 0 |
–block-concurrent-recompilation | block queued jobs until released | bool | false |
–concurrent-compiler-frontend | run optimizing compiler’s frontend phases on a separate thread | bool | false |
–strict-heap-broker | fail on incomplete serialization | bool | false |
–trace-heap-broker | trace the heap broker | bool | false |
–stress-runs | number of stress runs | int | 0 |
–deopt-every-n-times | deoptimize every n times a deopt point is passed | int | 0 |
–print-deopt-stress | print number of possible deopt points | bool | false |
–turbo-sp-frame-access | use stack pointer-relative access to frame wherever possible | bool | false |
–turbo-preprocess-ranges | run pre-register allocation heuristics | bool | true |
–turbo-filter | optimization filter for TurboFan compiler | string | * |
–trace-turbo | trace generated TurboFan IR | bool | false |
–trace-turbo-path | directory to dump generated TurboFan IR to | string | nullptr |
–trace-turbo-filter | filter for tracing turbofan compilation | string | * |
–trace-turbo-graph | trace generated TurboFan graphs | bool | false |
–trace-turbo-scheduled | trace TurboFan IR with schedule | bool | false |
–trace-turbo-cfg-file | trace turbo cfg graph | for C1 visualizer to a given file name | string |
–trace-turbo-types | trace TurboFan’s types | bool | true |
–trace-turbo-scheduler | trace TurboFan’s scheduler | bool | false |
–trace-turbo-reduction | trace TurboFan’s various reducers | bool | false |
–trace-turbo-trimming | trace TurboFan’s graph trimmer | bool | false |
–trace-turbo-jt | trace TurboFan’s jump threading | bool | false |
–trace-alloc | trace register allocator | bool | false |
–trace-all-uses | trace all use positions | bool | false |
–trace-representation | trace representation types | bool | false |
–turbo-verify | verify TurboFan graphs at each phase | bool | false |
–turbo-verify-machine-graph | verify TurboFan machine graph before instruction selection | string | nullptr |
–trace-verify-csa | trace code stubs verification | bool | false |
–csa-trap-on-node | trigger break point when a node with given id is created in given stub. The format is: StubName,NodeId | string | nullptr |
–turbo-stats | print TurboFan statistics | bool | false |
–turbo-stats-nvp | print TurboFan statistics in machine-readable format | bool | false |
–turbo-stats-wasm | print TurboFan statistics of wasm compilations | bool | false |
–turbo-splitting | split nodes during scheduling in TurboFan | bool | true |
–function-context-specialization | enable function context specialization in TurboFan | bool | false |
–turbo-inlining | enable inlining in TurboFan | bool | true |
–max-inlined-bytecode-size | maximum size of bytecode for a single inlining | int | 500 |
–max-inlined-bytecode-size-cumulative | maximum cumulative size of bytecode considered for inlining | int | 1000 |
–max-inlined-bytecode-size-absolute | maximum cumulative size of bytecode considered for inlining | int | 5000 |
–reserve-inline-budget-scale-factor | maximum cumulative size of bytecode considered for inlining | float | 1.2 |
–max-inlined-bytecode-size-small | maximum size of bytecode considered for small function inlining | int | 30 |
–min-inlining-frequency | minimum frequency for inlining | float | 0.15 |
–polymorphic-inlining | polymorphic inlining | bool | true |
–stress-inline | set high thresholds for inlining to inline as much as possible | bool | false |
–trace-turbo-inlining | trace TurboFan inlining | bool | false |
–inline-accessors | inline JavaScript accessors | bool | true |
–inline-into-try | inline into try blocks | bool | true |
–turbo-inline-array-builtins | inline array builtins in TurboFan code | bool | true |
–use-osr | use on-stack replacement | bool | true |
–trace-osr | trace on-stack replacement | bool | false |
–analyze-environment-liveness | analyze liveness of environment slots and zap dead values | bool | true |
–trace-environment-liveness | trace liveness of local variable slots | bool | false |
–turbo-load-elimination | enable load elimination in TurboFan | bool | true |
–trace-turbo-load-elimination | trace TurboFan load elimination | bool | false |
–turbo-profiling | enable profiling in TurboFan | bool | false |
–turbo-verify-allocation | verify register allocation in TurboFan | bool | false |
–turbo-move-optimization | optimize gap moves in TurboFan | bool | true |
–turbo-jt | enable jump threading in TurboFan | bool | true |
–turbo-loop-peeling | Turbofan loop peeling | bool | true |
–turbo-loop-variable | Turbofan loop variable optimization | bool | true |
–turbo-cf-optimization | optimize control flow in TurboFan | bool | true |
–turbo-escape | enable escape analysis | bool | true |
–turbo-allocation-folding | Turbofan allocation folding | bool | true |
–turbo-instruction-scheduling | enable instruction scheduling in TurboFan | bool | false |
–turbo-stress-instruction-scheduling | randomly schedule instructions to stress dependency tracking | bool | false |
–turbo-store-elimination | enable store-store elimination in TurboFan | bool | true |
–trace-store-elimination | trace store elimination | bool | false |
–turbo-rewrite-far-jumps | rewrite far to near jumps | ia32,x64 | bool |
–experimental-inline-promise-constructor | inline the Promise constructor in TurboFan | bool | true |
–untrusted-code-mitigations | Enable mitigations for executing untrusted code | bool | false |
–branch-load-poisoning | Mask loads with branch conditions. | bool | false |
–minimal | simplifies execution model to make porting easier | e.g. always use Ignition, never optimize | bool |
–expose-wasm | expose wasm interface to JavaScript | bool | true |
–assume-asmjs-origin | force wasm decoder to assume input is internal asm-wasm format | bool | false |
–wasm-disable-structured-cloning | disable wasm structured cloning | bool | false |
–wasm-num-compilation-tasks | number of parallel compilation tasks for wasm | int | 10 |
–wasm-write-protect-code-memory | write protect code memory on the wasm native heap | bool | false |
–wasm-trace-serialization | trace serialization/deserialization | bool | false |
–wasm-async-compilation | enable actual asynchronous compilation for WebAssembly.compile | bool | true |
–wasm-test-streaming | use streaming compilation instead of async compilation for tests | bool | false |
–wasm-max-mem-pages | maximum number of 64KiB memory pages of a wasm instance | uint | 32767 |
–wasm-max-table-size | maximum table size of a wasm instance | uint | 10000000 |
–wasm-tier-up | enable wasm baseline compilation and tier up to the optimizing compiler | bool | true |
–trace-wasm-ast-start | start function for wasm AST trace | inclusive | int |
–trace-wasm-ast-end | end function for wasm AST trace | exclusive | int |
–liftoff | enable Liftoff, the baseline compiler for WebAssembly | bool | true |
–wasm-trace-memory | print all memory updates performed in wasm code | bool | false |
–wasm-tier-mask-for-testing | bitmask of functions to compile with TurboFan instead of Liftoff | int | 0 |
–validate-asm | validate asm.js modules before compiling | bool | true |
–suppress-asm-messages | don’t emit asm.js related messages | for golden file testing | bool |
–trace-asm-time | log asm.js timing info to the console | bool | false |
–trace-asm-scanner | log tokens encountered by asm.js scanner | bool | false |
–trace-asm-parser | verbose logging of asm.js parse failures | bool | false |
–stress-validate-asm | try to validate everything as asm.js | bool | false |
–dump-wasm-module-path | directory to dump wasm modules to | string | nullptr |
–experimental-wasm-mv | enable prototype multi-value support for wasm | bool | false |
–experimental-wasm-eh | enable prototype exception handling opcodes for wasm | bool | false |
–experimental-wasm-se | enable prototype sign extension opcodes for wasm | bool | true |
–experimental-wasm-sat-f2i-conversions | enable prototype saturating float conversion opcodes for wasm | bool | false |
–experimental-wasm-threads | enable prototype thread opcodes for wasm | bool | false |
–experimental-wasm-simd | enable prototype SIMD opcodes for wasm | bool | false |
–experimental-wasm-anyref | enable prototype anyref opcodes for wasm | bool | false |
–experimental-wasm-mut-global | enable prototype import/export mutable global support for wasm | bool | true |
–wasm-opt | enable wasm optimization | bool | false |
–wasm-no-bounds-checks | disable bounds checks | performance testing only | bool |
–wasm-no-stack-checks | disable stack checks | performance testing only | bool |
–wasm-shared-engine | shares one wasm engine between all isolates within a process | bool | true |
–wasm-shared-code | shares code underlying a wasm module when it is transferred | bool | true |
–wasm-trap-handler | use signal handlers to catch out of bounds memory access in wasm | currently Linux x86_64 only | bool |
–wasm-trap-handler-fallback | Use bounds checks if guarded memory is not available | bool | false |
–wasm-fuzzer-gen-test | Generate a test case when running a wasm fuzzer | bool | false |
–print-wasm-code | Print WebAssembly code | bool | false |
–wasm-interpret-all | Execute all wasm code in the wasm interpreter | bool | false |
–asm-wasm-lazy-compilation | enable lazy compilation for asm-wasm modules | bool | true |
–wasm-lazy-compilation | enable lazy compilation for all wasm modules | bool | false |
–frame-count | number of stack frames inspected by the profiler | int | 1 |
–type-info-threshold | percentage of ICs that must have type info to allow optimization | int | 25 |
–stress-sampling-allocation-profiler | Enables sampling allocation profiler with X as a sample interval | int | 0 |
–min-semi-space-size | min size of a semi-space | in MBytes), the new space consists of two semi-spaces | size_t |
–max-semi-space-size | max size of a semi-space | in MBytes), the new space consists of two semi-spaces | size_t |
–semi-space-growth-factor | factor by which to grow the new space | int | 2 |
–experimental-new-space-growth-heuristic | Grow the new space based on the percentage of survivors instead of their absolute value. | bool | false |
–max-old-space-size | max size of the old space | in Mbytes | size_t |
–initial-old-space-size | initial old space size | in Mbytes | size_t |
–gc-global | always perform global GCs | bool | false |
–random-gc-interval | Collect garbage after random(0, X allocations. It overrides gc_interval. | int | 0 |
–gc-interval | garbage collect after allocations | int | -1 |
–retain-maps-for-n-gc | keeps maps alive for old space garbage collections | int | 2 |
–trace-gc | print one trace line following each garbage collection | bool | false |
–trace-gc-nvp | print one detailed trace line in name=value format after each garbage collection | bool | false |
–trace-gc-ignore-scavenger | do not print trace line after scavenger collection | bool | false |
–trace-idle-notification | print one trace line following each idle notification | bool | false |
–trace-idle-notification-verbose | prints the heap state used by the idle notification | bool | false |
–trace-gc-verbose | print more details following each garbage collection | bool | false |
–trace-allocation-stack-interval | print stack trace after free-list allocations | int | -1 |
–trace-duplicate-threshold-kb | print duplicate objects in the heap if their size is more than given threshold | int | 0 |
–trace-fragmentation | report fragmentation for old space | bool | false |
–trace-fragmentation-verbose | report fragmentation for old space | detailed | bool |
–trace-evacuation | report evacuation statistics | bool | false |
–trace-mutator-utilization | print mutator utilization, allocation speed, gc speed | bool | false |
–incremental-marking | use incremental marking | bool | true |
–incremental-marking-wrappers | use incremental marking for marking wrappers | bool | true |
–trace-unmapper | Trace the unmapping | bool | false |
–parallel-scavenge | parallel scavenge | bool | true |
–trace-parallel-scavenge | trace parallel scavenge | bool | false |
–write-protect-code-memory | write protect code memory | bool | true |
–concurrent-marking | use concurrent marking | bool | true |
–parallel-marking | use parallel marking in atomic pause | bool | true |
–ephemeron-fixpoint-iterations | number of fixpoint iterations it takes to switch to linear ephemeron algorithm | int | 10 |
–trace-concurrent-marking | trace concurrent marking | bool | false |
–black-allocation | use black allocation | bool | true |
–concurrent-store-buffer | use concurrent store buffer processing | bool | true |
–concurrent-sweeping | use concurrent sweeping | bool | true |
–parallel-compaction | use parallel compaction | bool | true |
–parallel-pointer-update | use parallel pointer update during compaction | bool | true |
–detect-ineffective-gcs-near-heap-limit | trigger out-of-memory failure to avoid GC storm near heap limit | bool | true |
–trace-incremental-marking | trace progress of the incremental marking | bool | false |
–trace-stress-marking | trace stress marking progress | bool | false |
–trace-stress-scavenge | trace stress scavenge progress | bool | false |
–track-gc-object-stats | track object counts and memory usage | bool | false |
–trace-gc-object-stats | trace object counts and memory usage | bool | false |
–trace-zone-stats | trace zone memory usage | bool | false |
–track-retaining-path | enable support for tracking retaining path | bool | false |
–concurrent-array-buffer-freeing | free array buffer allocations on a background thread | bool | true |
–gc-stats | Used by tracing internally to enable gc statistics | int | 0 |
–track-detached-contexts | track native contexts that are expected to be garbage collected | bool | true |
–trace-detached-contexts | trace native contexts that are expected to be garbage collected | bool | false |
–move-object-start | enable moving of object starts | bool | true |
–memory-reducer | use memory reducer | bool | true |
–heap-growing-percent | specifies heap growing factor as | 1 + heap_growing_percent/100 | int |
–v8-os-page-size | override OS page size | in KBytes | int |
–always-compact | Perform compaction on every full GC | bool | false |
–never-compact | Never perform compaction on full GC - testing only | bool | false |
–compact-code-space | Compact code space on full collections | bool | true |
–use-marking-progress-bar | Use a progress bar to scan large objects in increments when incremental marking is active. | bool | true |
–force-marking-deque-overflows | force overflows of marking deque by reducing its size to 64 words | bool | false |
–stress-compaction | stress the GC compactor to flush out bugs | implies —force_marking_deque_overflows | bool |
–stress-compaction-random | Stress GC compaction by selecting random percent of pages as evacuation candidates. It overrides stress_compaction. | bool | false |
–stress-incremental-marking | force incremental marking for small heaps and run it more often | bool | false |
–fuzzer-gc-analysis | prints number of allocations and enables analysis mode for gc fuzz testing, e.g. —stress-marking, —stress-scavenge | bool | false |
–stress-marking | force marking at random points between 0 and X. inclusive percent of the regular marking start limit | int | |
–stress-scavenge | force scavenge at random points between 0 and X. inclusive percent of the new space capacity | int | |
–disable-abortjs | disables AbortJS runtime function | bool | false |
–manual-evacuation-candidates-selection | Test mode only flag. It allows a unit test to select evacuation candidates pages. Requires —stress_compaction). | bool | |
–fast-promotion-new-space | fast promote new space on high survival rates | bool | false |
–clear-free-memory | initialize free memory with 0 | bool | false |
–young-generation-large-objects | allocates large objects by default in the young generation large object space | bool | false |
–debug-code | generate extra code. assertions for debugging | bool | false |
–code-comments | emit comments in code disassembly. for more readable source positions you should add —no-concurrent_recompilation | bool | false |
–enable-sse3 | enable use of SSE3 instructions if available | bool | true |
–enable-ssse3 | enable use of SSSE3 instructions if available | bool | true |
–enable-sse4-1 | enable use of SSE4.1 instructions if available | bool | true |
–enable-sahf | enable use of SAHF instruction if available | X64 only | bool |
–enable-avx | enable use of AVX instructions if available | bool | true |
–enable-fma3 | enable use of FMA3 instructions if available | bool | true |
–enable-bmi1 | enable use of BMI1 instructions if available | bool | true |
–enable-bmi2 | enable use of BMI2 instructions if available | bool | true |
–enable-lzcnt | enable use of LZCNT instruction if available | bool | true |
–enable-popcnt | enable use of POPCNT instruction if available | bool | true |
–arm-arch | generate instructions for the selected ARM architecture if available: armv6, arm |