Skip to content
Discussion options

You must be logged in to vote

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:

  1. Allow specific modules via environment variable (self-hosted only): in your docker-compose.yml, add under the n8n service's environment: section:

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.

  1. For heavier logic, use the Execute Command node instead of Code node it runs an …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by OMI-KALIX
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants