> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/integrations/community-nodes/installation-and-management/environment-variable-installation.md).

# Environment variable installation

{% hint style="info" %}
**Available from n8n v2.21.0**
{% endhint %}

On self-hosted n8n, you can manage the set of installed community packages from environment variables. n8n reconciles the installed packages against the list on every startup, installing missing packages, correcting versions, and uninstalling packages not in the list. Use this method to bootstrap an instance with a fixed set of packages, for example through a deployment pipeline.

{% hint style="warning" %}
**Enabling this uninstalls packages that aren't in the list**

The first time you start n8n with `N8N_COMMUNITY_PACKAGES_MANAGED_BY_ENV=true`, n8n uninstalls any currently-installed community packages that aren't included in `N8N_COMMUNITY_PACKAGES`. If you already manage packages through the UI, review the **Community nodes** settings page and add the packages you want to keep to `N8N_COMMUNITY_PACKAGES` before enabling this variable.
{% endhint %}

## Configure <a href="#configure" id="configure"></a>

Set the following environment variables on your n8n instance, then restart:

| Variable                                | Type        | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------------------------------- | ----------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `N8N_COMMUNITY_PACKAGES_MANAGED_BY_ENV` | Boolean     | `false` | Set to `true` to manage installed community packages from environment variables. When `true`, n8n reconciles the installed packages against `N8N_COMMUNITY_PACKAGES` on every startup, installing missing packages, correcting versions, and **uninstalling any currently-installed packages that aren't in the list**. The **Community nodes** settings page becomes read-only: you can't install, update, or uninstall packages from the UI while this is enabled. |
| `N8N_COMMUNITY_PACKAGES`                | JSON string | -       | JSON array of community packages to install. Each entry is an object with a `name` (required) and optional `version` and `checksum` fields. You can also embed the version in the name as `<package-name>@<version>`. See [environment variable installation](/integrations/community-nodes/installation-and-management/environment-variable-installation.md) for the full per-field reference.                                                                      |

{% hint style="info" %}
**Community packages must be enabled**

`N8N_COMMUNITY_PACKAGES_ENABLED` must be `true` (the default). If community packages are disabled at the instance level, n8n ignores `N8N_COMMUNITY_PACKAGES_MANAGED_BY_ENV` and logs a warning on startup.
{% endhint %}

For example:

```bash
export N8N_COMMUNITY_PACKAGES_MANAGED_BY_ENV=true
export N8N_COMMUNITY_PACKAGES='[{"name":"n8n-nodes-foo","version":"1.2.3"}]'
```

While `N8N_COMMUNITY_PACKAGES_MANAGED_BY_ENV` is `true`, the **Community nodes** settings page is read-only: you can't install, update, or uninstall packages from the UI.

### Per-package fields <a href="#per-package-fields" id="per-package-fields"></a>

| Field      | Type   | Required | Description                                                                                                                                                                                                                     |
| ---------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`     | string | Yes      | npm package name. You can include the version inline as `<package-name>@<version>`. If you do, don't also set the `version` field to a different value, n8n rejects conflicting versions.                                       |
| `version`  | string | No       | Version specifier. If omitted, n8n looks the package up in the vetted-packages registry and uses that version; if the package isn't vetted, n8n installs whatever npm resolves and won't reconcile the version across restarts. |
| `checksum` | string | No       | SHA-512 checksum (`sha512-...`) for the resolved tarball. Requires `version` to be set. n8n resolves the checksum automatically from the vetted registry when possible.                                                         |

Example with all three fields:

```json
[
  { "name": "n8n-nodes-foo", "version": "1.2.3" },
  { "name": "n8n-nodes-bar@0.5.0" },
  { "name": "n8n-nodes-baz", "version": "2.0.0", "checksum": "sha512-..." }
]
```

{% hint style="warning" %}
**Unverified packages need a checksum**

If a package isn't in the vetted-packages registry and `N8N_UNVERIFIED_PACKAGES_ENABLED` is `false`, n8n fails to start. Either pin a `checksum` for the package, set `N8N_UNVERIFIED_PACKAGES_ENABLED=true`, or pick a vetted package.
{% endhint %}

For the supported ways to set environment variables, see [Configuration methods](/deploy/host-n8n/configure-n8n/basic-configuration.md).

## Manage packages <a href="#manage-packages" id="manage-packages"></a>

To add, remove, upgrade, or downgrade a package, edit `N8N_COMMUNITY_PACKAGES` and restart n8n. n8n reconciles to the new list on the next startup.

{% hint style="warning" %}
**Breaking changes in versions**

Node developers may introduce breaking changes in new versions of their nodes. A breaking change is an update that breaks previous functionality. Be careful when changing versions. If a new version causes issues, set `version` back to the previous value and restart n8n to roll back.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.n8n.io/integrations/community-nodes/installation-and-management/environment-variable-installation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
