Repository navigation
|
i unable to used an code node js and python bcz external and internal modules are disallowed so fix this or give me some alternate way to fix this |
Replies: 2 comments
|
This is expected behavior, not a bug n8n's built-in Code node runs JS/Python in a restricted sandbox, and by default it blocks importing external npm packages and most internal Node built-ins for security reasons. A couple of ways around it:
NODE_FUNCTION_ALLOW_EXTERNAL=moment,lodash,axios
|
|
Yo @OMI-KALIX — @devAffaan is spot on. If you're self-hosting, just drop NODE_FUNCTION_ALLOW_EXTERNAL=axios,lodash (or whatever you need) in your docker-compose.yml and restart the stack. If you're on n8n Cloud, you can't touch those env vars. Skip the Code node entirely and use the Execute Command node to run real Python/Node scripts without the sandbox restrictions. |
This is expected behavior, not a bug n8n's built-in Code node runs JS/Python in a restricted sandbox, and by default it blocks importing external npm packages and most internal Node built-ins for security reasons. A couple of ways around it:
NODE_FUNCTION_ALLOW_EXTERNAL=moment,lodash,axios
NODE_FUNCTION_ALLOW_BUILTIN=crypto,fs
List only the specific packages/built-ins you need this is the official, supported way to unlock them. Restart the stack after adding it.
For heavier logic, use the Execute Command node instead of Code node it runs an …