n8n · Code node

Cannot find module '<module>'

Short answer

This n8n Code node error occurs if you use require and n8n cannot find the module. On self-hosted n8n, install the module into your n8n environment. With npm, install it in the same environment as n8n. With Docker, extend the official n8n image with a custom image that includes your module.

VerifiedLast verified

01Error text

n8n error
Cannot find module '<module>'

02Likely causes

  • The module is not installed in the n8n environment, or importing it is not allowed.
  • n8n doesn't support importing modules in the Cloud version.

03How to fix it

  1. On self-hosted n8n, install the module into your n8n environment. With npm, install it in the same environment as n8n. With Docker, extend the official n8n image with a custom image that includes your module.
  2. Set the NODE_FUNCTION_ALLOW_BUILTIN and NODE_FUNCTION_ALLOW_EXTERNAL environment variables to allow importing modules.

04Official documentation

Test every fix in a non-production environment before you apply it to production. See how entries are verified.

More for n8n work:Open n8n jobsn8n rates and salaries

The iPaaS Brief

Subscribe to The iPaaS Brief.

The iPaaS newsletter for the people who run integrations. From iPaaS Group.

Free. You finish on theipaasbrief.com and confirm by email.