app.runningUnderARM64Translation property readonly macOS Windows
A read-only boolean property which when true indicates that the app is currently running under an ARM64 translator like the macOS Rosetta Translator Environment or Windows WOW (Windows on Windows). You can use this property to prompt users to download the arm64 version of your application when they are mistakenly running the x64 version under Rosetta or WOW.
app.commandLine property readonly
A read-only CommandLine object that allows you to read and manipulate the command line arguments that Chromium uses.
app.isPackaged property readonly
A read-only boolean property that returns true if the app is packaged, false otherwise. For many apps, this property can be used to distinguish development and production environments.
--disable-ntlm-v2 switch
The --disable-ntlm-v2 switch disables NTLM v2 for POSIX platforms and has no effect on other platforms.
--disable-http-cache switch
The --disable-http-cache switch disables the disk cache for HTTP requests.
--disable-http2 switch
The --disable-http2 switch disables HTTP/2 and SPDY/3.1 protocols.
--disable-geolocation switch platform support
The --disable-geolocation switch disables the Geolocation API and denies permission requests internally. This functionality is implemented only for macOS and has no effect on other platforms. Permission requests for geolocation will be denied regardless of handlers set via session.setPermissionRequestHandler.
--disable-renderer-backgrounding switch
The --disable-renderer-backgrounding switch prevents Chromium from lowering the priority of invisible pages' renderer processes. This flag is global to all renderer processes. To disable throttling in only one window, use the hack of playing silent audio.
--disk-cache-size switch
The --disk-cache-size=size switch forces the maximum disk space to be used by the disk cache, specified in bytes.
--enable-logging switch usage
The --enable-logging[=file] switch prints Chromium's logging to stderr or optionally to a log file. Passing --enable-logging prints logs to stderr. Passing --enable-logging=file saves logs to the file specified by --log-file=..., or to electron_debug.log in the user-data directory if --log-file is not specified. The ELECTRON_ENABLE_LOGGING environment variable has the same effect. On Windows, logs from child processes cannot be sent to stderr; logging to a file is the most reliable way to collect logs.
--force-fieldtrials switch
The --force-fieldtrials=trials switch forcefully enables or disables field trials. Example: WebRTC-Audio-Red-For-Opus/Enabled/
--host-resolver-rules switch
The --host-resolver-rules=rules switch takes a comma-separated list of rules that control how hostnames are mapped. Examples: MAP * 127.0.0.1 forces all hostnames to 127.0.0.1; MAP *.google.com proxy forces google.com subdomains to proxy; MAP test.com [::1]:77 forces test.com to IPv6 loopback with port 77; MAP * baz, EXCLUDE www.google.com remaps everything to baz except www.google.com. These rules only apply to the host resolver.
--ignore-certificate-errors switch
The --ignore-certificate-errors switch ignores certificate related errors.
--ignore-connections-limit switch
The --ignore-connections-limit=domains switch ignores the connections limit for a comma-separated list of domains.
--js-flags switch
The --js-flags=flags switch specifies flags passed to the V8 engine. In order to enable flags in the main process, this switch must be passed on startup. Example: electron --js-flags="--harmony_proxies --harmony_collections" your-app. Run node --v8-options or electron --js-flags="--help" to see available flags. These can enable early-stage JavaScript features or manipulate garbage collection. Example for tracing V8 optimization: electron --js-flags="--trace-opt --trace-deopt" your-app
--lang switch
The --lang switch sets a custom locale.
--log-file switch
The --log-file=path switch specifies where logs will be written if --enable-logging is specified. The parent directory must exist. Setting the ELECTRON_LOG_FILE environment variable is equivalent to passing this flag. If both are present, the command-line switch takes precedence.
--log-net-log switch
The --log-net-log=path switch enables net log events to be saved and writes them to the specified path.
--log-level switch
The --log-level=N switch sets the verbosity of logging when used with --enable-logging. N should be one of Chrome's LogSeverities. This switch controls LOG() messages, while --v and --vmodule control VLOG() messages. VLOG() can be thought of as sub-levels or per-module levels inside LOG(INFO) to control the firehose of LOG(INFO) data.
--no-proxy-server switch
The --no-proxy-server switch disables the proxy server and makes all connections direct. It overrides any other proxy server flags passed.
--no-stdio-init switch
The --no-stdio-init switch disables stdio initialization during node initialization. Used to avoid node initialization crash when the nul device is disabled on Windows platform.
--remote-debugging-port switch
The --remote-debugging-port=port switch enables remote debugging over HTTP on the specified port.
--v switch
The --v=log_level switch gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels. This switch only works when --enable-logging is also passed.
--vmodule switch
The --vmodule=pattern switch gives per-module maximal V-logging levels to override the value given by --v. Example: my_module=2,foo*=3 changes logging level for all code in source files my_module.* and foo*.*. Any pattern containing forward or backward slash is tested against the whole pathname. Example: */foo/bar/*=2 changes logging level for all code in source files under a foo/bar directory. This switch only works when --enable-logging is also passed.
--force_high_performance_gpu switch
The --force_high_performance_gpu switch forces using discrete GPU when there are multiple GPUs available.
--force_low_power_gpu switch
The --force_low_power_gpu switch forces using integrated GPU when there are multiple GPUs available.
--xdg-portal-required-version switch
The --xdg-portal-required-version=version switch sets the minimum required version of XDG portal implementation in order to use the portal backend for file dialogs on Linux. File dialogs will fallback to using gtk or kde depending on the desktop environment when the required version is unavailable. Current default is set to 3.
--inspect-brk-node Node.js flag
The --inspect-brk-node[=[host:]port] flag activates the inspector on host:port and breaks at the start of the first internal JavaScript script executed when the inspector is available. Default host:port is 127.0.0.1:9229.
--inspect-port Node.js flag
The --inspect-port=[host:]port flag sets the host:port to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is 127.0.0.1. Aliased to --debug-port=[host:]port.
--inspect Node.js flag
The --inspect[=[host:]port] flag activates the inspector on host:port. Default is 127.0.0.1:9229. V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Electron instances. The tools attach to Electron instances via a TCP port and communicate using the Chrome DevTools Protocol. Aliased to --debug[=[host:]port.
--inspect-publish-uid Node.js flag
The --inspect-publish-uid=stderr,http flag specifies ways the inspector web socket URL is exposed. By default the inspector websocket URL is available in stderr and under /json/list endpoint on http://host:port/json/list.
--experimental-network-inspection Node.js flag
The --experimental-network-inspection flag enables support for DevTools network inspector events, for visibility into requests made by the nodejs http and https modules.
--experimental-inspector-network-resource Node.js flag
The --experimental-inspector-network-resource flag enables support for resolving source maps over the network when using the Node.js inspector. When enabled, DevTools can retrieve remote source maps for main and utility process scripts via the Node.js inspector. Be mindful that the Node.js inspector will make network requests to URLs specified in source maps in environments where the process has access to internal networks.
--no-deprecation Node.js flag
The --no-deprecation flag silences deprecation warnings.
--throw-deprecation Node.js flag
The --throw-deprecation flag throws errors for deprecations.
--trace-deprecation Node.js flag
The --trace-deprecation flag prints stack traces for deprecations.
--trace-warnings Node.js flag
The --trace-warnings flag prints stack traces for process warnings, including deprecations.
--dns-result-order Node.js flag
The --dns-result-order=order flag sets the default value of the verbatim parameter in the Node.js dns.lookup() and dnsPromises.lookup() functions. Possible values are: ipv4first (sets default verbatim false) and verbatim (sets default verbatim true). The default is verbatim and dns.setDefaultResultOrder() has higher priority than --dns-result-order.
--diagnostic-dir Node.js flag
The --diagnostic-dir=directory flag sets the directory to which all Node.js diagnostic output files are written. Defaults to current working directory. Affects the default output directory of v8.setHeapSnapshotNearHeapLimit.
--no-experimental-global-navigator Node.js flag
The --no-experimental-global-navigator flag disables exposition of Navigator API on the global scope from Node.js.
--experimental-transform-types Node.js flag
The --experimental-transform-types flag enables the transformation of TypeScript-only syntax into JavaScript code.
Finding Chromium switches via about://flags
The easiest way to find undocumented Chromium switches is through Chromium's flags page at about://flags. Enable a flag there, then go to about://version to see the command-line arguments including flag-switches-begin and flag-switches-end markers containing the list of enabled switches. Most flags are included as part of --enable-features=, but some are standalone switches. A complete list exists in Chromium's flag metadata page at https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/flag-metadata.json, though this includes platform, environment, GPU specific, expired and potentially non-functional flags.
AlwaysLogLOAFURL Chromium feature
The AlwaysLogLOAFURL Chromium feature enables script attribution for long-animation-frame PerformanceObserver events for non-http(s), non-data, non-blob URLs such as file: or custom protocol URLs.
Node.js flags support note
Electron supports some CLI flags supported by Node.js. Passing unsupported command line switches to Electron when it is not running in ELECTRON_RUN_AS_NODE will have no effect.
--auth-server-whitelist switch
The --auth-server-whitelist switch takes a comma-separated list of URLs for which integrated authentication is enabled. URLs are matched with optional wildcard prefix (*). For example: --auth-server-whitelist='*example.com, *foobar.com, *baz' will enable integrated authentication for any URL ending with example.com, foobar.com, or baz. Without * prefix, the URL must match exactly.
--auth-negotiate-delegate-whitelist switch
The --auth-negotiate-delegate-whitelist switch takes a comma-separated list of servers for which delegation of user credentials is required. Without * prefix the URL has to match exactly.
ELECTRON_LOG_ASAR_READS environment variable
When ELECTRON_LOG_ASAR_READS is set, Electron logs the read offset and file path to the system tmpdir when reading from an ASAR file. The resulting file can be provided to the ASAR module to optimize file ordering.
NODE_EXTRA_CA_CERTS environment variable
NODE_EXTRA_CA_CERTS specifies additional Certificate Authority certificates. If the nodeOptions fuse is disabled, NODE_EXTRA_CA_CERTS will be ignored. Example: export NODE_EXTRA_CA_CERTS=/path/to/cert.pem
GOOGLE_API_KEY for geolocation support
Geolocation support in Electron requires the use of Google Cloud Platform's geolocation webservice. To enable this feature, acquire a Google API key and set it in the main process file before opening any browser windows that will make geolocation requests using process.env.GOOGLE_API_KEY = 'YOUR_KEY_HERE'. A newly generated Google API key may not be allowed to make geolocation requests by default; enable it through the API library. A Billing Account must be added to the project associated to the API key for the geolocation webservice to work.
ELECTRON_NO_ASAR environment variable
ELECTRON_NO_ASAR disables ASAR support. This variable is only supported in forked child processes and spawned child processes that set ELECTRON_RUN_AS_NODE.
ELECTRON_RUN_AS_NODE environment variable
ELECTRON_RUN_AS_NODE starts the process as a normal Node.js process. In this mode, you can pass cli options to Node.js as with the normal Node.js executable, with the exception of: --openssl-config, --use-bundled-ca, --use-openssl-ca, --force-fips, --enable-fips. These flags are disabled because Electron uses BoringSSL instead of OpenSSL. If the runAsNode fuse is disabled, ELECTRON_RUN_AS_NODE will be ignored.
ELECTRON_NO_ATTACH_CONSOLE on Windows
ELECTRON_NO_ATTACH_CONSOLE prevents attachment to the current console session on Windows.
ELECTRON_FORCE_WINDOW_MENU_BAR on Linux
ELECTRON_FORCE_WINDOW_MENU_BAR prevents using the global menu bar on Linux.
ELECTRON_TRASH on Linux
ELECTRON_TRASH sets the trash implementation on Linux. Default is 'gio'. Options are: gvfs-trash, trash-cli, kioclient5, kioclient.
ELECTRON_ENABLE_LOGGING environment variable
ELECTRON_ENABLE_LOGGING prints Chromium's internal logging to the console. Setting this variable is the same as passing --enable-logging on the command line.
NODE_OPTIONS environment variable support
Electron includes support for a subset of Node's NODE_OPTIONS. The majority are supported with the exception of those which conflict with Chromium's use of BoringSSL. Unsupported options are: --use-bundled-ca, --force-fips, --enable-fips, --openssl-config, --use-openssl-ca. NODE_OPTIONS are explicitly disallowed in packaged apps, except for: --max-http-header-size, --http-parser. If the nodeOptions fuse is disabled, NODE_OPTIONS will be ignored. Example: export NODE_OPTIONS="--no-warnings --max-old-space-size=2048"
ELECTRON_LOG_FILE environment variable
ELECTRON_LOG_FILE sets the file destination for Chromium's internal logging. Setting this variable is the same as passing --log-file on the command line.
ELECTRON_DEBUG_NOTIFICATIONS on macOS
ELECTRON_DEBUG_NOTIFICATIONS adds extra logs to Notification lifecycles on macOS to aid in debugging. Extra logging is displayed when new Notifications are created or activated, and when common actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.
ELECTRON_DEBUG_MSIX_UPDATER on Windows
ELECTRON_DEBUG_MSIX_UPDATER adds extra logs to MSIX updater operations on Windows to aid in debugging. Extra logging is displayed when MSIX update operations are initiated, including package updates, package registration, and restart registration. This helps diagnose issues with MSIX package updates and deployments.
ELECTRON_ENABLE_STACK_DUMPING environment variable
ELECTRON_ENABLE_STACK_DUMPING prints the stack trace to the console when Electron crashes. This environment variable will not work if the crashReporter is started.