Describe the problem/error/question
In the Code node, const n = require(‘net’); throws an error, even though ‘net’ should be an allowed module by using -e NODE_FUNCTION_ALLOW_EXTERNAL=net,ssh2,node,node:net (by using this config, ‘ssh2’ is available to the Code node, but ‘net’ and ‘node:net’ are not).
The Execute Command node is able to run nodejs and use net: nodejs -e “const n = require(‘net’); console.log(n);” outputs the expected contents of the net module. So net seems to be installed/available to node just not n8n.
But the Code node throws the error when trying do the same thing.
What is the error message (if any)?
ERROR: Cannot find module ‘net’ [line 1]
Please share your workflow
Information on your n8n setup
- n8n version: 1.16
- Database (default: SQLite): Postgres
- n8n EXECUTIONS_PROCESS setting (default: own, main): Default
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Ubuntu