Automate NPM Package Installation and Updates for Self-Hosted Environments
Are you looking to install external libraries for your self-hosted N8N instance? This automated workflow makes adding npm packages to your N8N environment quick and effortless.  **Beware, this workflow only works on self-hosted instances.** ## What This Workflow Does This solution automatically installs npm packages like axios, cheerio, or node-fetch in your self-hosted N8N Docker container, making them immediately available in Code nodes. ### Key features - **Automated Installation:** No manual npm commands needed - **Daily Updates:** Scheduled trigger keeps packages current - **Smart Installation:** Only installs missing packages - **Multiple Triggers:** Manual, scheduled, and on startup of the N8N instance so you can upgrade your N8N version without worrying about external libraries. ## How to install and update external libraries automatically ### Step 1: Setting Up Your Environment Variables Before using external libraries in N8N Code nodes, configure these environment variables in your Docker compose file. #### Option A to allow specific external npm packages in N8N Code nodes ``` NODE_FUNCTION_ALLOW_EXTERNAL=axios,cheerio,node-fetch ``` #### Option B to allow all external npm packages in Code nodes ``` NODE_FUNCTION_ALLOW_EXTERNAL=* ``` ### Step 2: Import the external packages workflow Import the workflow into your N8N instance by copying and pasting all nodes. ### Step 3: Input the list of external libraries you need Edit the libraries_set node. Change the comma-separated list (e.g., axios, cheerio, node-fetch). **If you chose Option A above**, update your NODE_FUNCTION_ALLOW_EXTERNAL variable with the same packages. ### Step 4: Start the workflow! Run the workflow manually or let it trigger automatically. ## Why use this to install NPM packages in N8N? Managing external packages manually in N8N can be time-consuming. This workflow automates the entire process, making sure your libraries are always installed and up-to-date.
Are you looking to install external libraries for your self-hosted N8N instance? This automated workflow makes adding npm packages to your N8N environment quick and effortless.
Beware, this workflow only works on self-hosted instances.
What This Workflow Does
This solution automatically installs npm packages like axios, cheerio, or node-fetch in your self-hosted N8N Docker container, making them immediately available in Code nodes.
Key features
- Automated Installation: No manual npm commands needed
- Daily Updates: Scheduled trigger keeps packages current
- Smart Installation: Only installs missing packages
- Multiple Triggers: Manual, scheduled, and on startup of the N8N instance so you can upgrade your N8N version without worrying about external libraries.
How to install and update external libraries automatically
Step 1: Setting Up Your Environment Variables
Before using external libraries in N8N Code nodes, configure these environment variables in your Docker compose file.
Option A to allow specific external npm packages in N8N Code nodes
NODE_FUNCTION_ALLOW_EXTERNAL=axios,cheerio,node-fetch
Option B to allow all external npm packages in Code nodes
NODE_FUNCTION_ALLOW_EXTERNAL=*
Step 2: Import the external packages workflow
Import the workflow into your N8N instance by copying and pasting all nodes.
Step 3: Input the list of external libraries you need
Edit the libraries_set node. Change the comma-separated list (e.g., axios, cheerio, node-fetch).
If you chose Option A above, update your NODE_FUNCTION_ALLOW_EXTERNAL variable with the same packages.
Step 4: Start the workflow!
Run the workflow manually or let it trigger automatically.
Why use this to install NPM packages in N8N?
Managing external packages manually in N8N can be time-consuming. This workflow automates the entire process, making sure your libraries are always installed and up-to-date.
New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.
Secure checkout powered by Stripe
Support
How to import this workflow into n8n
- 1Purchase or download the workflow to get the n8n workflow JSON file.
- 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
- 3Open each node marked with a credential warning and connect your own accounts and API keys.
- 4Run the workflow once manually to verify the data flow, then toggle it to Active.
Related Development & IT workflows
- Create daily historical AI videos with Gemini, fal.ai, Telegram and YouTube$14.99
- Advanced multi-agent AI personal assistant with 250+ task capabilities (WhatsApp + GPT)$2.99
- Send Organized Security CVE Digests from NVD with AI-Polished Summaries to Gmail$4.99
- Learn n8n basics in 3 easy steps ✨$14.99
- Automated multi-platform sales agent with RAG, CRM & payment processing$2.99
- Version Control n8n Workflows in GitLab with Custom and Organization$14.99
Need this deployed? We'll set it up for you.
Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.