Describe the problem/error/question
This workflow used to work just fine, but it’s failing now.
I updated n8n this weekend, so it’s likely related to that.
I understand the message, but I didn’t see any notice about stop using require
and use import
instead. Also, the lib I use which fails specifies its version, so it’s not a package auto-update issue.
I guess there was a regression somehow?
Do I need to convert all my require
to import
?
export EXTRA_NODE_MODULES="[email protected] [email protected] [email protected] [email protected] [email protected] [email protected]"
What is the error message (if any)?
Error [ERR_REQUIRE_ESM]: require() of ES Module
Please share your workflow
Share the output returned by the last node
{
"errorMessage": "Unknown error null",
"errorDetails": {},
"n8nDetails": {
"nodeName": "Fetch cities's metadata",
"nodeType": "n8n-nodes-base.code",
"nodeVersion": 2,
"n8nVersion": "1.79.4 (Self Hosted)",
"binaryDataMode": "default",
"stackTrace": [
"Error [ERR_REQUIRE_ESM]: require() of ES Module /app/code/node_modules/node-fetch/src/index.js from /app/code/node_modules/@n8n/vm2/lib/resolver-compat.js not supported.",
"Instead change the require of index.js in /app/code/node_modules/@n8n/vm2/lib/resolver-compat.js to a dynamic import() which is available in all CommonJS modules.",
" at LegacyResolver.defaultRequire [as hostRequire] (/app/code/node_modules/@n8n/vm2/lib/resolver-compat.js:23:9)",
" at LegacyResolver.loadJS (/app/code/node_modules/@n8n/vm2/lib/resolver-compat.js:166:19)",
" at /app/code/node_modules/@n8n/vm2/lib/resolver.js:84:14",
" at VM2 Wrapper.apply (/app/code/node_modules/@n8n/vm2/lib/bridge.js:490:11)",
" at Module._extensions.<computed> (/app/code/node_modules/@n8n/vm2/lib/setup-node-sandbox.js:150:48)"
]
}
}
Information on your n8n setup
instance information
Debug info
core
- n8nVersion: 1.79.4
- platform: docker (self-hosted)
- nodeJsVersion: 20.18.0
- database: postgres
- executionMode: regular
- concurrency: -1
- license: enterprise (production)
- consumerId: dd75a504-2fc5-487b-b05e-368cf42d0cad
storage
- success: all
- error: all
- progress: false
- manual: true
- binaryMode: memory
pruning
- enabled: true
- maxAge: 365 hours
- maxCount: 10000 executions
client
- userAgent: mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/135.0.0.0 safari/537.36
- isTouchDevice: false
Generated at: 2025-04-14T18:21:44.237Z