npm#
npm 是在本地机器上快速开始使用 n8n 的方法。你必须先安装 Node.js。n8n 要求 Node.js 版本在 20.19 到 24.x 之间(含边界)。
🌐 npm is a quick way to get started with n8n on your local machine. You must have Node.js installed. n8n requires a Node.js version between 20.19 and 24.x, inclusive.
Stable and Beta versions
n8n releases a new minor version most weeks. The stable version is for production use. beta is the most recent release. The beta version may be unstable. To report issues, use the forum.
Current stable: 2.19.5
Current beta: 2.20.5
尝试使用 npx 和 n8n(Try n8n with npx)#
你可以使用 npx 试用 n8n,无需安装。
🌐 You can try n8n without installing it using npx.
从终端运行:
🌐 From the terminal, run:
1 | |
此命令将下载启动 n8n 所需的所有内容。然后,你可以通过打开 http://localhost:5678 来访问 n8n 并开始构建工作流。
🌐 This command will download everything that's needed to start n8n. You can then access n8n and start building workflows by opening http://localhost:5678.
使用 npm 全局安装(Install globally with npm)#
要全局安装 n8n,请使用 npm:
🌐 To install n8n globally, use npm:
1 | |
要安装或更新到 n8n 的特定版本,请使用 @ 语法来指定版本。例如:
🌐 To install or update to a specific version of n8n use the @ syntax to specify the version. For example:
1 | |
要安装 next:
🌐 To install next:
1 | |
安装完成后,运行以下命令启动 n8n:
🌐 After the installation, start n8n by running:
1 2 3 | |
下一步步骤(Next steps)#
通过快速入门试用 n8n。
🌐 Try out n8n using the Quickstarts.
正在更新(Updating)#
要将你的 n8n 实例更新到 latest 版本,请运行:
🌐 To update your n8n instance to the latest version, run:
1 | |
要安装 next 版本:
🌐 To install the next version:
1 | |
n8n with tunnel#
Danger
Use this for local development and testing. It isn't safe to use it in production.
Development tooling
The tunnel feature is a convenience tool for local development. The underlying implementation may change between n8n versions.
To use webhooks for trigger nodes of external services like GitHub, n8n has to be reachable from the web. n8n provides a tunnel service using cloudflared that redirects requests from the web to your local n8n instance. Docker must be installed for the tunnel to work.
There are two ways to use the tunnel, depending on how you run n8n:
需要 Docker
该隧道使用 cloudflared,它作为 Docker 容器运行。即使通过 npm 运行 n8n,也要确保在你的机器上安装了 Docker。
对于 npm 安装,请使用仅服务的方法。将 cloudflared 作为独立服务启动,然后在本地运行 n8n:
🌐 For npm installations, use the services only approach. Start cloudflared as a standalone service, then run n8n locally:
1 2 3 4 5 | |
services 命令启动 cloudflared,获取公共隧道 URL,并将 .env 文件写入 packages/cli/bin/.env,包含 WEBHOOK_URL 和 N8N_PROXY_HOPS=1。n8n 会在启动时自动获取该 .env。
🌐 The services command starts cloudflared, fetches the public tunnel URL, and writes a .env file to packages/cli/bin/.env with WEBHOOK_URL and N8N_PROXY_HOPS=1. n8n picks up this .env automatically on startup.
完成后请清理:
🌐 Clean up when done:
1 | |
有关完整堆栈方法(n8n 和 cloudflared 都在容器中),请参阅 Docker 隧道设置。
🌐 For the full stack approach (n8n and cloudflared both in containers), refer to the Docker tunnel setup.
回滚升级(Reverting an upgrade)#
安装你想要回滚到的旧版本。
🌐 Install the older version that you want to go back to.
如果升级涉及数据库迁移:
🌐 If the upgrade involved a database migration:
- 请查看功能文档和发行说明,了解是否需要进行任何手动更改。
- 在当前版本上运行
n8n db:revert来回滚数据库。如果你想回退多个数据库迁移,需要重复此过程。
Windows 故障排除(Windows troubleshooting)#
如果你在 Windows 上运行 n8n 时遇到问题,请确保你的 Node.js 环境已正确设置。请按照微软的指南 在 Windows 上安装 NodeJS。
🌐 If you are experiencing issues running n8n on Windows, make sure your Node.js environment is correctly set up. Follow Microsoft's guide to Install NodeJS on Windows.