Supported Node.js® Command line Options

The following command line options have been verified to work with the WinCC OA JavaScript Manager for Node.js:

Table 1. Supported Node.js Command Line Options
Option Description
--cpu-prof Enables CPU profiling on startup and writes the CPU profile to disk before exit.
--cpu-prof-dir Specifies the directory where CPU profiles generated by --cpu-prof will be placed.
--cpu-prof-name Specifies the file name of the CPU profile generated by --cpu-prof.
--diagnostic-dir Sets the directory to which all diagnostic output files are written. Defaults to current working directory.
--env-file Loads environment variables from the specified file. Useful for setting additional Node.js options via NODE_OPTIONS.
--expose-gc Exposes the garbage collector interface to user code, allowing manual garbage collection triggering.
--heap-prof Enables heap profiling on startup and writes the heap profile to disk before exit.
--heap-prof-dir Specifies the directory where heap profiles generated by --heap-prof will be placed.
--heap-prof-name Specifies the file name of the heap profile generated by --heap-prof.
--inspect[=[host:]port] Activates the inspector on the specified host and port. Default host is 127.0.0.1 and port is 9229. Allows debugging with Chrome DevTools.
--inspect-brk[=[host:]port] Activates the inspector and breaks before user code starts. Useful for debugging from the very beginning of script execution.
--max-old-space-size Sets the maximum memory size of the old generation heap in MB. Helps control memory usage and prevent out-of-memory errors.
--report-dir Specifies the directory where diagnostic reports are written. Used in conjunction with other report options.
--report-filename Specifies the filename for diagnostic reports. Can include placeholders for timestamp and process ID.
--report-on-fatalerror Enables automatic generation of diagnostic reports when a fatal error occurs, helping with debugging crashes.
--report-uncaught-exception Enables automatic generation of diagnostic reports when an uncaught exception occurs.
--watch Enables automatic restart of the application when file changes are detected in the current directory and its subdirectories.
Note:
This list will be extended with time.

Other options can be used at your own risk. Please note that command line options that rely on exception, exit or signal handling might not be compatible with the WinCC OA JavaScript Manager for Node.js.

For more information about the Node.js® command line interface, see the official documentation: https://nodejs.org/docs/latest-v20.x/api/cli.html

Note:
The length of the command line options string that can be specified for a manager in PMON is restricted. If not all command line options fit, it is possible to use --env-file and put more command line options into a text file with a NODE_OPTIONS line. For example, you can create a file called nodeOptions.env in the data directory of your project with the following contents:
NODE_OPTIONS='--report-on-fatalerror --report-dir=C:/WinCC_OA_Proj/MyProject/log/ --report-filename=MyManagerReport.json'
and add it to the options of the JavaScript manager:
--env-file=data/nodeOptions.env my-script.js