Skip to content

n8n v1.0 迁移指南(n8n v1.0 migration guide)#

本文档总结了在更新到 n8n 1.0 版本之前你应该了解的内容。

🌐 This document provides a summary of what you should be aware of before updating to version 1.0 of n8n.

n8n 1.0的发布标志着n8n在将其推向要求严格的生产环境方面迈出了重要一步。1.0版本代表了过去四年来为使n8n成为最易用、最强大且最灵活的自动化工具所投入的辛勤努力。n8n 1.0现在已经可以在生产环境中使用。

🌐 The release of n8n 1.0 marks a milestone in n8n's journey to make n8n available for demanding production environments. Version 1.0 represents the hard work invested over the last four years to make n8n the most accessible, powerful, and versatile automation tool. n8n 1.0 is now ready for use in production.

新功能(New features)#

代码节点中的 Python 支持(Python support in the Code node)#

尽管 JavaScript 仍然是默认语言,但你现在也可以在 Code 节点 中选择 Python,甚至可以使用 许多 Python 模块。请注意,在 v1.0 之前添加到工作流中的 Code 节点中无法使用 Python。

🌐 Although JavaScript remains the default language, you can now also select Python as an option in the Code node and even make use of many Python modules. Note that Python is unavailable in Code nodes added to a workflow before v1.0.

PR #4295, PR #6209

执行顺序(Execution order)#

n8n 1.0 为多分支工作流引入了新的执行顺序:

🌐 n8n 1.0 introduces a new execution order for multi-branch workflows:

在多分支工作流中,n8n 需要确定各分支节点的执行顺序。之前,n8n 会先执行每个分支的第一个节点,然后执行每个分支的第二个节点,依此类推(广度优先)。新的执行顺序确保每个分支在开始下一个分支之前会完全执行完毕(深度优先)。分支的执行顺序取决于它们在画布上的位置,从上到下。如果两个分支处于同一高度,则最左边的分支先执行。

🌐 In multi-branch workflows, n8n needs to determine the order in which to execute nodes on branches. Previously, n8n executed the first node of each branch, then the second of each branch, and so on (breadth-first). The new execution order ensures that each branch executes completely before starting the next one (depth-first). Branches execute based on their position on the canvas, from top to bottom. If two branches are at the same height, the leftmost one executes first.

n8n 以前执行多输入节点时,只要它们接收到其第一个输入的数据就会运行。连接到多输入节点第二个输入的节点会自动执行,无论它们是否接收到数据。n8n 1.0 中引入的新执行顺序简化了这种行为:节点现在只有在接收到数据时才会执行,多输入节点至少需要一个输入接收到数据才能执行。

🌐 n8n used to execute multi-input nodes as long as they received data on their first input. Nodes connected to the second input of multi-input nodes automatically executed regardless of whether they received data. The new execution order introduced in n8n 1.0 simplifies this behavior: Nodes are now executed only when they receive data, and multi-input nodes require data on at least one of their inputs to execute.

您现有的工作流将使用旧版顺序,而新的工作流将使用 v1 顺序执行。您可以在工作流设置中配置每个工作流的执行顺序。

🌐 Your existing workflows will use the legacy order, while new workflows will execute using the v1 order. You can configure the execution order for each workflow in workflow settings.

PR #4238, PR #6246, PR #6507

弃用项(Deprecations)#

MySQL 和 MariaDB(MySQL and MariaDB)#

n8n 已不再支持将 MySQL 和 MariaDB 作为 n8n 的存储后端。这些数据库系统仅有少数用户使用,但它们需要持续的开发和维护工作。n8n 建议迁移到 PostgreSQL,以获得更好的兼容性和长期支持。

🌐 n8n has deprecated support for MySQL and MariaDB as storage backends for n8n. These database systems are used by only a few users, yet they require continuous development and maintenance efforts. n8n recommends migrating to PostgreSQL for better compatibility and long-term support.

PR #6189

执行过程 和 “自有” 模式(EXECUTIONS_PROCESS and "own" mode)#

以前,你可以使用 EXECUTIONS_PROCESS 环境变量来指定执行是应该在 main 进程中运行还是在其 own 进程中运行。此选项和 own 模式现在已被弃用,并将在 n8n 的未来版本中移除。这是因为它增加了代码的复杂性,同时带来的好处有限。从 n8n 1.0 开始,main 将成为新的默认设置。

🌐 Previously, you could use the EXECUTIONS_PROCESS environment variable to specify whether executions should run in the main process or in their own processes. This option and own mode are now deprecated and will be removed in a future version of n8n. This is because it led to increased code complexity while offering marginal benefits. Starting from n8n 1.0, main will be the new default.

请注意,在 main 模式下,执行开始的速度要比在 own 模式下快得多。但是,如果工作流消耗的内存超过可用内存,可能会导致整个 n8n 应用崩溃,而不仅仅是工作线程。为避免这种情况,请确保分配足够的系统资源,或配置 队列模式 将执行分配到多个工作线程中。

🌐 Note that executions start much faster in main mode than in own mode. However, if a workflow consumes more memory than is available, it might crash the entire n8n application instead of just the worker thread. To mitigate this, make sure to allocate enough system resources or configure queue mode to distribute executions among multiple workers.

PR #6196

重大变更(Breaking changes)#

Docker#

权限变更(Permissions change)#

在使用基于 Docker 的部署时,n8n 进程现在由用户 node 运行,而不是 root。这一变化提高了安全性。

🌐 When using Docker-based deployments, the n8n process is now run by the user node instead of root. This change increases security.

如果在启动 n8n 时,n8n 容器日志中出现权限错误,你可能需要通过在 Docker 主机上执行以下命令来更新权限:

🌐 If permission errors appear in your n8n container logs when starting n8n, you may need to update the permissions by executing the following command on the Docker host:

1
docker run --rm -it --user root -v ~/.n8n:/home/node/.n8n --entrypoint chown n8nio/base:16 -R node:node /home/node/.n8n

移除镜像(Image removal)#

我们已移除 Debian 和 RHEL 镜像。如果你正在使用这些镜像,需要更换你使用的镜像。除非你是基于这些镜像制作自定义镜像,否则这不应该导致任何错误。

🌐 We've removed the Debian and RHEL images. If you were using these you need to change the image you use. This shouldn't result in any errors unless you were making a custom image based on one of those images.

入口点变更(Entrypoint change)#

容器的入口点已更改,你不再需要指定 n8n 命令。如果你之前运行的是 n8n worker --concurrency=5,现在应改为 worker --concurrency=5

🌐 The entrypoint for the container has changed and you no longer need to specify the n8n command. If you were previously running n8n worker --concurrency=5 it's now worker --concurrency=5

PR #6365

因表达式错误导致的工作流失败(Workflow failures due to expression errors)#

工作流执行可能由于表达式中的语法或运行时错误而失败,例如引用不存在的节点。虽然表达式已经在前端抛出错误,但此更改确保 n8n 在后端也会抛出错误,而以前这些错误会被静默忽略。为了接收失败工作流的通知,n8n 建议在工作流设置中设置“错误工作流”。

🌐 Workflow executions may fail due to syntax or runtime errors in expressions, such as those that reference non-existent nodes. While expressions already throw errors on the frontend, this change ensures that n8n also throws errors on the backend, where they were previously silently ignored. To receive notifications of failing workflows, n8n recommends setting up an "error workflow" under workflow settings.

PR #6352

必需的所有者账户(Mandatory owner account)#

此更改使得用户管理成为必需,并移除了对其他认证方法的支持,例如 BasicAuth 和外部 JWT。请注意,n8n.cloud 或自定义计划允许的用户数量仍取决于你的订阅类型。

🌐 This change makes User Management mandatory and removes support for other authentication methods, such as BasicAuth and External JWT. Note that the number of permitted users on n8n.cloud or custom plans still varies depending on your subscription.

PR #6362

自定义节点安装目录(Directory for installing custom nodes)#

n8n 不再从其全局 node_modules 目录加载自定义节点。相反,您必须将它们安装(或链接)到 ~/.n8n/custom(或 N8N_CUSTOM_EXTENSIONS 定义的目录)。作为 npm 包的自定义节点将位于 ~/.n8n/nodes。如果您有使用 npm link 链接到全局 node_modules 目录的自定义节点,您需要将它们重新链接到 ~/.n8n/nodes

🌐 n8n will no longer load custom nodes from its global node_modules directory. Instead, you must install (or link) them to ~/.n8n/custom (or a directory defined by N8N_CUSTOM_EXTENSIONS). Custom nodes that are npm packages will be located in ~/.n8n/nodes. If you have custom nodes that were linked using npm link into the global node_modules directory, you need to link them again, into ~/.n8n/nodes instead.

PR #6396

WebSockets#

N8N_PUSH_BACKEND 环境变量可用于配置向用户界面推送更新的两种可用方法之一:ssewebsocket。从 n8n 1.0 开始,默认方法是 websocket

🌐 The N8N_PUSH_BACKEND environment variable can be used to configure one of two available methods for pushing updates to the user interface: sse and websocket. Starting with n8n 1.0, websocket is the default method.

PR #6196

日期转换函数(Date transformation functions)#

n8n 提供了多种用于处理日期的转换函数。这些函数可能返回 JavaScript 的 Date 或 Luxon 的 DateTime 对象。根据新的行为,返回类型始终与输入类型匹配。如果你对 Date 调用日期转换函数,它会返回 Date。同样,如果你对 DateTime 对象调用该函数,它会返回 DateTime 对象。

🌐 n8n provides various transformation functions that operate on dates. These functions may return either a JavaScript Date or a Luxon DateTime object. With the new behavior, the return type always matches the input. If you call a date transformation function on a Date, it returns a Date. Similarly, if you call it on a DateTime object, it returns a DateTime object.

要识别可能受此更改影响的任何工作流和节点,你可以使用此实用工作流

🌐 To identify any workflows and nodes that might be impacted by this change, you can use this utility workflow.

有关日期转换函数的更多信息,请参阅官方文档

🌐 For more information about date transformation functions, please refer to the official documentation.

PR #6435

执行数据保留(Execution data retention)#

从 n8n 1.0 开始,所有成功、失败和手动的工作流执行都将默认保存。可以在“工作流设置”中为每个工作流修改这些设置,或者使用相应的环境变量全局修改。此外,EXECUTIONS_DATA_PRUNE 设置将默认启用,EXECUTIONS_DATA_PRUNE_MAX_COUNT 设置为 10,000。这些默认设置旨在防止使用 SQLite 时的性能下降。请根据你的具体需求和系统容量进行配置。

🌐 Starting from n8n 1.0, all successful, failed, and manual workflow executions will be saved by default. These settings can be modified for each workflow under "Workflow Settings," or globally using the respective environment variables. Additionally, the EXECUTIONS_DATA_PRUNE setting will be enabled by default, with EXECUTIONS_DATA_PRUNE_MAX_COUNT set to 10,000. These default settings are designed to prevent performance degradation when using SQLite. Make sure to configure them according to your individual requirements and system capacity.

PR #6577

已移除 N8N_USE_DEPRECATED_REQUEST_LIB(Removed N8N_USE_DEPRECATED_REQUEST_LIB)#

遗留的 request 库已经被废弃有一段时间了。从 n8n 1.0 开始,通过设置 N8N_USE_DEPRECATED_REQUEST_LIB 环境变量在 HTTP 请求节点中回退到它的功能已被完全移除。HTTP 请求节点现在将始终使用新的 HttpRequest 接口。

🌐 The legacy request library has been deprecated for some time now. As of n8n 1.0, the ability to fall back to it in the HTTP Request node by setting the N8N_USE_DEPRECATED_REQUEST_LIB environment variable has been fully removed. The HTTP Request node will now always use the new HttpRequest interface.

如果你构建自定义节点,请参考 HTTP 请求助手 获取有关迁移到新接口的更多信息。

🌐 If you build custom nodes, refer to HTTP request helpers for more information on migrating to the new interface.

PR #6413

移除 WEBHOOK_TUNNEL_URL(Removed WEBHOOK_TUNNEL_URL)#

从版本 0.227.0 开始,n8n 已将 WEBHOOK_TUNNEL_URL 配置选项重命名为 WEBHOOK_URL。在 n8n 1.0 中,WEBHOOK_TUNNEL_URL 已被移除。请更新你的设置以反映新的名称。有关此配置选项的更多信息,请参阅文档

🌐 As of version 0.227.0, n8n has renamed the WEBHOOK_TUNNEL_URL configuration option to WEBHOOK_URL. In n8n 1.0, WEBHOOK_TUNNEL_URL has been removed. Update your setup to reflect the new name. For more information about this configuration option, refer to the docs.

PR #1408

移除 Node 16 支持(Remove Node 16 support)#

n8n 现在需要 Node 18.17.0 或更高版本。以上。

🌐 n8n now requires Node 18.17.0 or above.

正在更新到 n8n 1.0(Updating to n8n 1.0)#

  1. 创建 n8n 的完整备份。
  2. n8n 建议在升级到 n8n 1.x 之前,先将 n8n 更新到最新的 n8n 0.x 版本。这将帮助你将任何潜在问题定位到正确的版本。一旦确认 n8n 0.x 可以正常启动且没有任何问题,就可以进行下一步操作。
  3. 仔细阅读上面的 弃用重大更改 部分,以评估它们可能对你的设置产生的影响。
  4. 更新至 n8n 1.0:
    • 在测试阶段(2023年7月24日之前):如果使用 Docker,请拉取 next Docker 镜像。
    • 2023年7月24日之后:如果使用Docker,请拉取 latest Docker镜像。
  5. 如果你遇到任何问题,请重新部署之前的 n8n 版本并恢复备份。

举报问题(Reporting issues)#

如果在更新到 n8n 1.0 的过程中遇到任何问题,请在社区论坛寻求帮助。

🌐 If you encounter any issues during the process of updating to n8n 1.0, please seek help in the community forum.

谢谢(Thank you)#

我们想花一点时间向所有用户表达我们的感激之情,感谢你们的持续支持和反馈。你们的贡献对于帮助我们将 n8n 打造为最优秀的自动化工具至关重要。随着 1.0 版本及以后版本的发布,我们很高兴能继续与你们合作。感谢你们成为我们旅程的一部分!

🌐 We would like to take a moment to express our gratitude to all of our users for their continued support and feedback. Your contributions are invaluable in helping us make n8n the best possible automation tool. We're excited to continue working with you as we move forward with the release of version 1.0 and beyond. Thank you for being a part of our journey!