ERROR: Cannot find module 'crypto' [line 1]

Hi everyone,

I am a newbie to n8n. I am trying to create a UUID and trying to import the crypto module. But it throws the error “Cannot find module ‘crypto’ [line 1]”.

I am running a self-hosted n8n Docker image. Everything else works great except for this error
I have included “NODE_FUNCTION_ALLOW_EXTERNAL=crypto” in my .env file and restarted my docker to no avail.

Am I missing something? Thank you for your patience

Trying to use the Crypto Module in the Code Node

What is the error message (if any)?

ERROR: Cannot find module ‘crypto’ [line 1]

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:0.222.2
  • **Database (default: SQLite): SQLITE
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • **Operating system:Ubuntu 20.04

Hi @Sandeep_Mallareddy - welcome to the community :cake:

You might not need the code node for this - can you generate the UUID in the crypto node, instead? It has the option for it, and might save you a bit of headache!

That option looks like this:
image

1 Like

Thank you for the quick reply! Appreciate it :smiley:

2 Likes