在代码节点中启用模块(Enable modules in Code node)#
出于安全原因,代码节点限制导入模块。可以通过设置以下环境变量来取消对内置模块和外部模块的限制:
🌐 For security reasons, the Code node restricts importing modules. It's possible to lift that restriction for built-in and external modules by setting the following environment variables:
NODE_FUNCTION_ALLOW_BUILTIN:用于内置模块NODE_FUNCTION_ALLOW_EXTERNAL:用于来自 n8n/node_modules 目录的外部模块。当环境变量未设置时,外部模块支持将被禁用。
1 2 3 4 5 6 7 8 9 10 11 | |
如果使用任务执行器
如果 n8n 实例已使用 任务运行器 设置,请将环境变量添加到任务运行器,而不是主 n8n 节点。
有关这些变量的更多信息,请参阅环境变量参考。
🌐 Refer to Environment variables reference for more information on these variables.