Skip to content

节点环境变量(Nodes environment variables)#

File-based configuration

You can add _FILE to individual variables to provide their configuration in a separate file. Refer to Keeping sensitive data in separate files for more details.

本页面列出了用于管理 n8n 中节点的环境变量配置选项,包括指定要加载或排除的节点、在代码节点中导入内置或外部模块,以及启用社区节点。

🌐 This page lists the environment variables configuration options for managing nodes in n8n, including specifying which nodes to load or exclude, importing built-in or external modules in the Code node, and enabling community nodes.

节点和社区节点设置(Nodes and community node settings)#

变量 类型 默认值 描述
N8N_COMMUNITY_PACKAGES_AUTH_TOKEN 字符串 - 私有 npm 注册表的身份验证令牌。与 N8N_COMMUNITY_PACKAGES_REGISTRY 一起使用,以在从私有注册表安装社区节点时对请求进行身份验证。
N8N_COMMUNITY_PACKAGES_ENABLED 布尔值 true 启用(true)或禁用(false)安装和加载社区节点的功能。如果设置为 false,则无论各自的设置如何,已验证和未验证的社区软件包都将不可用。
N8N_COMMUNITY_PACKAGES_PREVENT_LOADING 布尔值 false 阻止(true)或允许(false)在实例启动时加载已安装的社区节点。如果有故障节点阻止实例启动,请使用此选项。
N8N_COMMUNITY_PACKAGES_REGISTRY 字符串 https://registry.npmjs.org 用于从 NPM 仓库拉取社区包的 URL(需要许可)。
N8N_CUSTOM_EXTENSIONS 字符串 - 指定包含自定义节点的目录路径。
N8N_PYTHON_ENABLED 布尔值 true 是否在代码节点上启用 Python 执行。
N8N_UNVERIFIED_PACKAGES_ENABLED 布尔值 true N8N_COMMUNITY_PACKAGES_ENABLED 为 true 时,此变量控制是否启用从 NPM 注册表安装和使用未经验证的社区节点(true 表示启用,false 表示不启用)。
N8N_VERIFIED_PACKAGES_ENABLED 布尔值 true N8N_COMMUNITY_PACKAGES_ENABLED 为 true 时,该变量控制在节点面板中安装和使用时是否显示已验证的社区节点(true)或隐藏它们(false)。
NODE_FUNCTION_ALLOW_BUILTIN 字符串 - 允许用户在代码节点中导入特定的内置模块。使用 * 允许导入所有模块。n8n 默认禁用模块导入。
NODE_FUNCTION_ALLOW_EXTERNAL 字符串 - 允许用户在 Code 节点中导入特定的外部模块(来自 n8n/node_modules)。n8n 默认禁用模块导入。
NODES_ERROR_TRIGGER_TYPE 字符串 n8n-nodes-base.errorTrigger 指定要用作错误触发器的节点类型。
NODES_EXCLUDE 字符串数组 [\"n8n-nodes-base.executeCommand\", \"n8n-nodes-base.localFileTrigger\"] 指定哪些节点不加载。例如,要阻止在用户不可信时可能存在安全风险的节点:NODES_EXCLUDE: "[\"n8n-nodes-base.executeCommand\", \"@n8n/n8n-nodes-langchain.lmChatDeepSeek\"]"。要启用所有节点,请指定 NODES_EXCLUDE: "[]"
NODES_INCLUDE 字符串数组 - 指定要加载的节点。

管理已安装的社区软件包(Manage installed community packages)#

Available from n8n v2.21.0

从环境变量预先安装 社区包。有关 *_MANAGED_BY_ENV 模式,请参见 使用环境变量管理实例设置

🌐 Pre-provision installed community packages from environment variables. See Manage instance settings using environment variables for the *_MANAGED_BY_ENV pattern.

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 for the full per-field reference.