Introduction
In today’s world of software and cloud services, automation is king. Whether you want to streamline repetitive tasks, connect your favorite apps, or build powerful workflows that run automatically, automation tools make life easier. One such tool gaining popularity is n8n — an open-source workflow automation platform.
n8n (pronounced “n-eight-n”) stands out because it is highly customizable, extensible, and free. Unlike proprietary tools, n8n allows you to run your workflows on your own infrastructure, giving you full control over your data and privacy.
Why run n8n locally on Windows?
If you use a Windows machine, you might wonder: why install n8n locally instead of using cloud services or other platforms?
- Development and testing: Local installs allow developers to build and test workflows quickly without needing internet access or risking live data.
- Personal use: Automate your own desktop or local network tasks securely.
- Privacy: When your automation platform runs on your own computer, you keep sensitive data off third-party servers.
- Learning: Experiment with integrations, nodes, and triggers without worrying about deployment.
Installation options overview
There are several ways to install n8n on Windows:
- Native installation using Node.js and npm.
- Docker-based installation which uses containerization.
- Windows Subsystem for Linux (WSL), running Linux tools on Windows.
Each has pros and cons. Docker is great if you’re familiar with containers, and WSL provides a Linux environment within Windows. But for simplicity and accessibility, installing n8n natively using Node.js is an excellent choice — no extra tools or complex configurations needed.
Prerequisites
Before you start, make sure your system meets these requirements:
- Windows 10 or later: Older versions may not support necessary features or software versions.
- Basic command-line knowledge: You should be able to open and run commands in Command Prompt or PowerShell.
- Admin privileges: Installing Node.js and global npm packages often requires administrator access.
If you’re new to the command line, don’t worry — this guide will walk you through each step carefully.
Step 1: Install Node.js and npm
n8n is a Node.js application. Node.js is a JavaScript runtime that runs outside the browser, enabling server-side or desktop applications written in JavaScript. Along with Node.js, you get npm (Node Package Manager), a tool to install software packages like n8n.
Why Node.js LTS version?
Node.js releases two types of versions:
- LTS (Long-Term Support): Stable, tested versions recommended for most users and production.
- Current: Latest features, but less tested.
Always choose the LTS version to ensure stability and compatibility.
How to install Node.js on Windows
- Open your web browser and go to https://nodejs.org.
- Click the button that says LTS to download the Windows installer.
- Once the
.msi
file is downloaded, double-click it to run the installer. - Follow the installation wizard steps:
- Accept the license agreement.
- Choose the installation folder or keep the default.
- Make sure Add to PATH option is checked. This allows you to run Node.js and npm commands from any terminal.
- Complete the installation.
After installation, open PowerShell or Command Prompt and type:
node -v
npm -v
You should see version numbers printed. For example:
v18.16.0
9.6.5
This confirms Node.js and npm are installed correctly.
Common issues during Node.js installation
- Command not found errors: This usually means Node.js is not in your system PATH. Re-run the installer and double-check the “Add to PATH” option.
- Permission errors: Run the installer as administrator by right-clicking and choosing “Run as administrator.”
- Antivirus or firewall blocking install: Temporarily disable security software if installation fails.
Step 2: Install n8n via npm
With Node.js ready, it’s time to install n8n.
What is npm?
npm is a package manager that downloads and installs Node.js software packages. Think of it like an app store for JavaScript tools.
Installing n8n globally
To make n8n available as a command anywhere on your system, install it globally.
- Open PowerShell or Command Prompt.
Run:
npm install n8n -g
This downloads n8n and sets it up for global use.
What does g
mean?
g
stands for “global.” Without it, npm installs packages only inside the current folder (local install).- Global installs allow you to run
n8n
from any directory, just like any other command.
Troubleshooting npm install errors
- Permission denied errors: Run the terminal as administrator.
- Slow or failed installs: Try clearing npm cache with
npm cache clean --force
. - Proxy or firewall issues: If you’re behind a corporate proxy, configure npm to use the proxy.
Step 3: Start n8n
After installation, you can launch n8n and access its interface.
Starting n8n
Simply type:
n8n
This starts the n8n service, which listens on a local port and serves a web interface.
Accessing the interface
Open a web browser and go to:
http://localhost:5678
This brings up the n8n editor — a visual canvas where you build workflows by dragging and connecting nodes.
What you’ll see
- Left panel: Nodes and integrations.
- Center canvas: Your workflow workspace.
- Top menu: Save, execute, or manage workflows.
- Right panel: Node configuration.
Using n8n in the terminal
The terminal running n8n shows logs and errors. If you close the terminal window, n8n stops.
This setup is ideal for quick development but not for continuous use.
Step 4: (Optional) Set Up Environment Variables
To customize n8n’s behavior and security, environment variables come in handy.
What are environment variables?
They’re key-value pairs that tell programs how to run, such as which port to use or credentials for authentication.
Creating a .env
file
In the folder where you launch n8n (or any preferred location), create a .env
file with your favorite text editor and add variables like:
N8N_PORT=5678
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=securepassword
What these variables do:
N8N_PORT
: Changes the port n8n listens on (default 5678).N8N_BASIC_AUTH_ACTIVE
: Enables basic authentication, prompting users for a username and password before accessing the UI.N8N_BASIC_AUTH_USER
andN8N_BASIC_AUTH_PASSWORD
: Credentials for authentication.
How to use .env
with n8n
When you start n8n, it automatically reads the .env
file in the current directory and applies those settings.
Why enable basic auth?
Running n8n locally means the interface is accessible to anyone on your network or computer. Basic auth adds a login screen, preventing unauthorized access.
Step 5: Running n8n in the Background
Keeping n8n running after closing the terminal is essential for continuous automation.
Option 1: Using PM2
PM2 is a process manager designed for Node.js apps. It keeps programs running, restarts them if they crash, and can launch apps on system boot.
Installing PM2 globally
npm install pm2 -g
Starting n8n with PM2
pm2 start n8n
This command starts n8n as a background process.
Managing PM2 processes
View running apps:
pm2 list
Stop n8n:
pm2 stop n8n
Restart n8n:
pm2 restart n8n
Save process list for startup:
pm2 save
Set PM2 to launch on system startup:
pm2 startup
PM2 is reliable and widely used in production environments.
Option 2: Using Windows Task Scheduler
If you prefer native Windows tools, you can create a batch file (.bat) to start n8n and schedule it with Task Scheduler to run at boot or login.
Basic batch script example
Create a file start-n8n.bat
with content:
@echo off
cd C:\path\to\n8n\folder
n8n
Adjust the path to where you want to run n8n.
Setting up Task Scheduler
- Open Task Scheduler.
- Create a new task.
- Set triggers (e.g., “At log on” or “At startup”).
- Set action to run your batch file.
- Save and test.
This method requires more manual setup but uses built-in Windows features.
Troubleshooting Tips
Despite careful steps, you might face issues. Here are solutions to common problems.
Port conflicts
If n8n complains that port 5678 is busy:
Check which app uses it with:
netstat -aon | findstr :5678
Kill the process using that port or change n8n’s port in
.env
or with:
n8n start --port=5679
Node/npm not recognized
If your terminal says:
'node' is not recognized as an internal or external command
- Node.js is not in your PATH.
- Fix by reinstalling Node.js with PATH option enabled.
- Or add Node.js install folder (e.g.,
C:\Program Files\nodejs\
) to the system environment PATH manually.
Permission errors on npm install
Global npm installs sometimes fail due to permission issues.
- Run PowerShell or Command Prompt as administrator.
- Alternatively, change npm’s global install directory to a user folder.
- Or use nvm-windows, a Node.js version manager that avoids permission problems.
n8n startup fails or crashes
- Check logs in the terminal for specific errors.
- Ensure Node.js version is supported (LTS recommended).
- Delete
~/.n8n
folder to reset settings if corrupted (backup workflows first). - Look for missing dependencies or network issues.
Alternative: Using Docker (Brief Mention)
If you’re comfortable with Docker, it offers an isolated environment to run n8n without installing Node.js.
Why use Docker?
- Easy setup and cleanup.
- Runs consistently across different machines.
- Easy to upgrade by pulling new images.
Basic Docker command
docker run -it --rm \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
This starts n8n with data persistence.
Learning Docker?
Check out the official n8n Docker documentation here:
https://docs.n8n.io/getting-started/installation/docker
Docker requires learning container basics but can be powerful for advanced users.
Conclusion
You’ve now mastered installing n8n on Windows using Node.js and npm — a straightforward approach perfect for beginners and those wanting local control.
What we covered:
- Installing Node.js and npm.
- Installing n8n globally.
- Starting n8n and accessing the browser interface.
- Using environment variables for customization and security.
- Keeping n8n running continuously with PM2 or Task Scheduler.
- Troubleshooting common installation and runtime issues.
- A brief look at the Docker alternative.
Why install locally?
Running n8n on your Windows machine gives you a secure, flexible automation platform at your fingertips. You control your workflows, your data, and can develop and test with full freedom.
Next steps
- Explore building workflows by connecting apps like Gmail, Slack, Google Sheets, or Twitter.
- Learn how to trigger workflows based on events like HTTP requests or scheduled times.
- Share and export workflows to collaborate or backup.