Ir para o conteúdo principal

Variáveis de Ambiente

Controle configurações e comportamento de aplicações sem mudar o código.

Certos comportamentos do Electron são controlados por variáveis de ambientes porque são inicializados antes que as flags da linha de comando e o código da aplicação.

Exemplo de shell POSIX:

$ electron

Exemplo de console do Windows:

> electron

Production Variables

The following environment variables are intended primarily for use at runtime in packaged Electron applications.


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.


export NODE_OPTIONS="--no-warnings --max-old-space-size=2048"

Unsupported options are:


NODE_OPTIONS are explicitly disallowed in packaged apps, except for the following:


If the nodeOptions fuse is disabled, NODE_OPTIONS will be ignored.


See Node.js cli documentation for details.

export NODE_EXTRA_CA_CERTS=/path/to/cert.pem 

If the nodeOptions fuse is disabled, NODE_EXTRA_CA_CERTS will be ignored.


Geolocation support in Electron requires the use of Google Cloud Platform's geolocation webservice. To enable this feature, acquire a Google API key and place the following code in your main process file, before opening any browser windows that will make geolocation requests:


By default, a newly generated Google API key may not be allowed to make geolocation requests. To enable the geolocation webservice for your project, enable it through the API library.

N.B. You will need to add a Billing Account to the project associated to the API key for the geolocation webservice to work.


Disables ASAR support. This variable is only supported in forked child processes and spawned child processes that set ELECTRON_RUN_AS_NODE.


Starts the process as a normal Node.js process.

In this mode, you will be able to pass cli options to Node.js as you would when running the normal Node.js executable, with the exception of the following flags:

  • "--openssl-config"
  • "--use-bundled-ca"
  • "--use-openssl-ca",
  • "--force-fips"
  • "--enable-fips"

These flags are disabled owing to the fact that Electron uses BoringSSL instead of OpenSSL when building Node.js' crypto module, and so will not work as designed.

If the runAsNode fuse is disabled, ELECTRON_RUN_AS_NODE will be ignored.


Don't attach to the current console session.


Don't use the global menu bar on Linux.


Set the trash implementation on Linux. Por padrão é gio.


  • gvfs-trash
  • trash-cli
  • kioclient5
  • kioclient


Selects the preferred platform backend used on Linux. The default one is x11. auto selects Wayland if possible, X11 otherwise.


  • auto
  • wayland
  • x11

Variáveis de desenvolvimento

As seguintes variáveis de ambiente são destinadas principalmente para fins de depuração e desenvolvimento.


Prints Chromium's internal logging to the console.

Setting this variable is the same as passing --enable-logging on the command line. Para obter mais informações, consulte --enable-logging na mudança de linha de comando.


Sets the file destination for Chromium's internal logging.

Setting this variable is the same as passing --log-file on the command line. Para obter mais informações, consulte --log-file na mudança de linha de comando.


Adds extra logs to Notification lifecycles on macOS to aid in debugging. Extra logging will be displayed when new Notifications are created or activated. They will also be displayed when common actions are taken: a notification is shown, dismissed, its button is clicked, or it is replied to.

Sample output:

Notification created (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)
Notification displayed (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)
Notification activated (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)
Notification replied to (com.github.Electron:notification:EAF7B87C-A113-43D7-8E76-F88EC9D73D44)


When Electron reads from an ASAR file, log the read offset and file path to the system tmpdir. The resulting file can be provided to the ASAR module to optimize file ordering.


Imprime o rastreamento da pilha para o console quando o Electron trava.

Essa variável de ambiente não funcionará se o crashReporter tiver iniciado.


Mostra a caixa de diálogo de travamento do Windows quando o Electron trava.

Essa variável de ambiente não funcionará se o crashReporter tiver iniciado.


When running from the electron package, this variable tells the electron command to use the specified build of Electron instead of the one downloaded by npm install. Usando:

export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing

Set By Electron

Electron sets some variables in your environment at runtime.


This variable is set to the value of XDG_CURRENT_DESKTOP that your application originally launched with. Electron sometimes modifies the value of XDG_CURRENT_DESKTOP to affect other logic within Chromium so if you want access to the original value you should look up this environment variable instead.