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 仍然是默认语言,但你现在也可以在 代码节点 中选择 Python 作为选项,甚至可以使用 多个 Python 模块。请注意,在 v1.0 之前的版本中,添加到工作流的代码节点不支持 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 和 "own" 模式#

¥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 的完整备份。

¥Create a full backup of n8n. 2. n8n 建议在升级到 n8n 1.x 之前,先升级到最新的 n8n 0.x 版本。这将帮助你将任何潜在问题精确定位到正确的版本。确认 n8n 0.x 可以正常启动后,请继续执行下一步。

¥n8n recommends updating to the latest n8n 0.x release before updating to n8n 1.x. This will allow you to pinpoint any potential issues to the correct release. Once you have verified that n8n 0.x starts up without any issues, proceed to the next step. 3. 请仔细阅读上面的 弃用项重大变化 部分,评估它们可能对你的设置产生的影响。

¥Carefully read the Deprecations and Breaking Changes sections above to assess how they may affect your setup. 4. 更新至 n8n 1.0:

¥Update to n8n 1.0:

  • 在 Beta 测试期间(2023 年 7 月 24 日之前):如果使用 Docker,请拉取 next Docker 镜像。

    ¥During beta (before July 24th 2023): If using Docker, pull the next Docker image.

  • 2023 年 7 月 24 日之后:如果使用 Docker,请拉取 latest Docker 镜像。

    ¥After July 24th 2023: If using Docker, pull the latest Docker image. 5. 如果你遇到任何问题,请重新部署之前的 n8n 版本并恢复备份。

¥If you encounter any issues, redeploy the previous n8n version and restore the backup.

举报问题#

¥Reporting issues

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

¥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!