跳到主要内容

Execute Command 节点常见问题#

以下是 Execute Command 节点 的常见错误与问题及其解决方法或排查步骤。

命令执行失败: <命令> /bin/sh: <命令>: 未找到#

当 shell 环境无法在 Command 参数中找到某个命令时,会出现此错误。

解决此错误需检查以下事项:

  • 检查 Command 参数中的命令及其参数是否存在拼写错误。
  • 确认该命令位于运行 n8n 用户的 PATH 环境变量中。
  • 若通过 Docker 运行 n8n,请尝试手动执行命令以确认容器内是否可用该命令。若容器未包含该命令,可能需要基于自定义镜像扩展官方 n8n 镜像来包含所需命令。
    • 若 n8n 已在运行:
# Find n8n's container ID, it will be the first column
docker ps | grep n8n
# Try to execute the command within the running container
docker container exec <container_ID> <command_to_run>

如果 n8n 未运行:

# Start up a new container that runs the command instead of n8n
# Use the same image and tag that you use to run n8n normally
docker run -it --rm --entrypoint /bin/sh docker.n8n.io/n8nio/n8n -c <command_to_run>

错误:stdout 输出超出 maxBuffer 限制#

当命令返回的输出量超过 Execute Command 节点单次处理能力时,会触发此错误。

解决方案:

  1. 减少命令产生的输出量
  2. 查阅命令手册或文档,确认是否存在限制/过滤输出的参数
  3. 若无可用参数,可通过管道将输出传递至其他命令进行内容过滤