Enabling Built in library in code node and Execute Command node

Describe the problem/error/question

Hi, I’m running n8n community edition installed via npm on a Mac Mini (Apple Silicon, macOS) managed by a launchd plist at /Library/LaunchDaemons/com.n8n.plist. I’m running into two issues.
First, I’m trying to enable the Execute Command node, which I understand is blocked by default. I’ve tried setting NODES_EXCLUDE= both as an environment variable in the launchd plist’s EnvironmentVariables dict and in a .env file placed in my N8N_USER_FOLDER, but the node still doesn’t appear in the node panel after reloading the service.

Second, I’m trying to use built-in Node.js modules (fs, path) inside the Code node. I’ve set NODE_FUNCTION_ALLOW_BUILTIN=fs,path in both the plist and the .env file, but I get “module fs is disallowed” when trying to require(‘fs’), and process appears to be completely undefined in the Code node sandbox. Has anyone successfully enabled the Execute Command node and built-in module access on a self-hosted npm install on macOS? Any guidance on the correct configuration and how to verify the environment variables are actually being picked up by the running n8n process would be really appreciated.

What is the error message (if any)?

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: 2.20.11
  • Database (default: SQLite): Default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: MacOS

hi @KH_C

A safer alternative is to avoid enabling fs or Execute Command and use the native nodes instead, is that possible for you? For local files, use Read/Write Files from Disk; to generate files, use Convert to File; to extract content, use Extract From File. This avoids depending on the Code node’s sandbox and also reduces the security risk of enabling Execute Command. I would only enable it if you really need to execute system binaries.

@KH_C both issues are real on 2.x so worth unpacking.

execute command got blocked by default starting in 2.x. the documented unblock is NODES_EXCLUDE set to a literal empty JSON array string, not just empty equals. in your plist:

<key>NODES_EXCLUDE</key>
<string>[]</string>

heads up though, Unable to re-enable Execute Command node in n8n 2.0 · Issue #23439 · n8n-io/n8n · GitHub is an open issue where users report this doesn’t always take effect, so file that under known annoyance.

your .env file isn’t doing anything btw, launchd literally doesnt read .env files, only the plist EnvironmentVariables dict matters. after editing the plist you need a full unload+load (not stop/start):

sudo launchctl unload /Library/LaunchDaemons/com.n8n.plist
sudo launchctl load /Library/LaunchDaemons/com.n8n.plist

then sudo launchctl getenv NODES_EXCLUDE to confirm. if that returns [] and Execute Command still isn’t there after a hard browser reload you’re hitting #23439 not a config issue.

for fs and path, n8n 2.x runs Code nodes in task runner subprocesses by default. internal mode inherits env from the main n8n process so once launchctl getenv NODE_FUNCTION_ALLOW_BUILTIN returns fs,path it should propagate to the runner. then const fs = require('fs') works directly inside the Code node. process being undefined is intentional even with builtins enabled — security boundary, don’t try to access it.