Electron: how to configure NodeJS and runtime Chrome flags

  • Post by Nicolas Ramz
  • Feb 03, 2019
Electron: how to configure NodeJS and runtime Chrome flags

Here is how to specify Node and Chrome flags as you would do when working in Chrome or NodeJS.

appendSwitch API

Electron allows you to configure the runtime environment as well as V8 specific flags and also Chrome-related flags using command line switches.

All these switches can be configured using JavaScript in your code by using the app.commandLine.appendSwitch API before the app is ready:

const { app } = require('electron');
app.commandLine.appendSwitch('remote-debugging-port', '8315');
app.on('ready', () => {
  // Your code here

This page lists every command line switch that’s available when starting Electron using electron command.


To specify V8 or NodeJS related options that are usually configured using the command line – like --harmony to use staged ECMAScript features – you may can pass them using the --js-flags switch:

const { app } = require('electron');
app.commandLine.appendSwitch('--js-flags', '--harmony_proxies');

Chrome Flags

Electron also provides a way to configure the Chrome/Chromium flags you have usually access to by typing chrome://flags in the address bar.

This has to be done in each window that is opened using the WebPreferences and _enabledlinkFeatures_property when calling the BrowserWindow constructor.

For example, to enable the OverlayScrollbars flag, you would use the following code:

const window = new BrowserWindow({
    height: 600,
    webPreferences: {
        enableBlinkFeatures: 'OverlayScrollbars'

Some Chrome flags can also be disabled using the disableBlinkFeatures property.

For the complete list of features that can be enabled or disabled you can check this page.