Run JavaScript and Node.js with GraalVM Enterprise

Oracle GraalVM Enterprise Edition includes an ECMAScript compliant JavaScript engine. It is designed to be fully standard compliant, execute applications with higher performance, and provide all the benefits from the GraalVM stack, e.g. language interoperability and common tooling. With that engine, GraalVM Enterprise can execute JavaScript and Node.js applications.

To get started with running JavaScript and Node.js applications with GraalVM Enterprise, proceed to the JavaScript and Node.js tutorial.

JavaScript and Node.js Command Line Options

On the command line, --js.<property>=<value> sets options that tune language features and extensions. The following options are currently supported:

Basic Options of js Launcher

Option Description
-e, --eval CODE Evaluate the code.
-f, --file FILE Load a script file.
--strict Run in strict mode.
--version Print the version and exit.

Language Options

Option Description
--js.ecmascript-version Emulate a specific ECMAScript version. Integer value (5-9), default is the latest version.
--js.intl-402 Enable ECMAScript Internationalization API. Boolean value, default is false.
--js.strict Enable strict mode for all scripts. Boolean value, default is false.

GraalVM Options

Option Description
--jvm Enable Java interoperability and execute the application on the JVM.
–-vm.<option> Pass JVM options to GraalVM (e.g. --jvm.Xmx<size>). List available JVM options with
–-vm.D<name>=<value> Set system properties. For example, --jvm.Dgraal.TraceTruffleCompilation=true will print finished compilations.
--native.<option> Pass VM options and system properties to a native image. List available VM options.
--engine.Mode=default Configure the execution mode of the engine. The execution mode automatically tunes the polyglot engine towards latency or throughput. throughput - collects the maximum amount of profiling information and compile using the maximum number of optimizations. This mode results in slower application startup but better throughput. This mode uses the compiler configuration community or enterprise if not specified otherwise. default - uses a balanced engine configuration. This mode uses the compiler configuration community or enterprise if not specified otherwise. latency - collects only minimal profiling information and compile as fast as possible with less optimal generated code. This mode results in faster application startup but less optimal throughput. This mode uses the compiler configuration economy if not specified otherwise.
–-engine.CompilerConfiguration=name Select the GraalVM compiler configuration to use for polyglot application code. If omitted, the compiler configuration with the highest auto-selection priority is used. To see the set of available configurations, supply the value help to this option. The current configurations and their semantics are: enterprise - produces highly optimized code with a possible trade-off to compilation time. This value is only available in GraalVM Enterprise. community - produces reasonably optimized code with a faster compilation time. economy - compiles as fast as possible with less optimal throughput of the generated code.
--engine.TraceCompilation=false Print an informational line to the console for each completed compilation.
--experimental-options Unlock experimental features that are behind flags. For example, to diagnose the memory allocations of a JavaScript application with --memtracer profiling tool, run js --experimental-options --memtracer program.js. The option is experimental.

Polyglot Options

Option Description
--polyglot Enable interoperability with other GraalVM languages.
--<languageID>.<property>=<value> Passes options to guest languages through the GraalVM Polyglot SDK.

The --<languageID>.<property>=<value> syntax is to allow any language launcher to access the options of other GraalVM supported languages.

Warning: If the option is entitled as experimental, it might never be included in a production version, or might change significantly before being considered production-ready.