How to run n8n locally using Node.js


A simple, step by step guide for learning and development
Automation means teaching your computer to do repetitive tasks for you, the same way you might teach a friend to make tea while you do something else. n8n is a tool that lets you connect different apps and services and make them work together automatically. For example, you can tell n8n to save every new email into a spreadsheet, or to send a message when a form is filled. You do this by visually connecting building blocks, without writing large amounts of code.
This post explains what n8n is, the other ways people run n8n, and then how to run it on your Windows PC with Node.js for free. The goal is learning and testing. If you do not want to pay for cloud hosting yet, this local setup is perfect for development and small tasks.
What is n8n ?
Imagine n8n as your personal online assistant, ready to handle tasks for you with ease. You can instruct it to perform actions such as:
“Whenever someone fills out a Google Form, automatically add the information to my Google Sheet.”
“When a new email arrives in my inbox, send me a notification via WhatsApp.”
n8n will carry out these tasks automatically, streamlining your workflow. The best part is that you don't need any coding skills to make this happen. You simply connect different blocks, much like assembling pieces of Lego, to create automated workflows that suit your needs. This makes it accessible and user-friendly for anyone looking to automate repetitive tasks without diving into complex programming.
Ways to Run n8n and Why You Might Choose Them
Run on your local computer with Node.js (what we do here)
This option is great for learning and testing. It's free and easy to set up. The downside is it only works when your computer is on.Run with Docker on your machine or a server
Docker packages n8n and all its requirements into a container. This makes the setup more consistent and easier to transfer between machines. It's a bit more advanced to learn but is closer to a production setup.Host on a virtual server or managed platform
You can host n8n on a cloud virtual private server or use platforms that allow one-click app deployment. This lets you run n8n 24/7. It usually costs money but provides constant availability and public access for webhooks.Use n8n Cloud or other paid services
With a paid plan, the company takes care of hosting, backups, and scaling. This reduces maintenance work, but it costs money and your data is stored on someone else's servers.
If you're concerned about costs, start locally. The community edition is fully capable of learning and building many workflows. You can later switch to Docker or the cloud if you need 24/7 uptime.
Before we start: what you'll need
A Windows PC.
Internet access for downloads.
A browser like Chrome or Edge.
About 10 minutes of your time.
We'll be using CMD for the commands.
Step by step: install Node.js and run n8n on Windows (cmd)
Why Node.js. Node.js is the runtime that runs JavaScript programs on your computer. n8n is a JavaScript program, so it needs Node.js. npm is the package manager that comes with Node.js. We use npm to install n8n.
1. Install Node.js (LTS)
Open your browser and go to https://nodejs.org
Click the LTS download for Windows and run the installer.
After install, open Command Prompt (cmd) and run these commands to check the installation:
node -v
npm -v
You should see version numbers. If you do, Node.js and npm are installed.
2. Install n8n Globally
Open Command Prompt as a regular user and run:
npm install n8n -g
Why use global. The -g
flag allows the n8n
command to be used from any location in cmd, so you can start it from any folder.
If you encounter permission errors, close cmd, reopen it as Administrator, and try the command again. If it still doesn't work, reinstall Node.js and ensure the installer added npm to your PATH.
3. Start n8n
In the same Command Prompt window start n8n with:
n8n
You will see logs in the console. When n8n is ready, it will show a line with the editor address. By default, it is:
Open this URL in your browser to access the n8n signup/login page. Congratulations, you have just learned how to run n8n in Node.js!
Note: If you close the Command Prompt, n8n will stop working. Make sure it runs in the background.
Quick note about giving Node more memory (cmd)
If you build large workflows and see memory problems, you can give Node more memory for the current cmd session like this:
set NODE_OPTIONS=--max-old-space-size=4096 n8n
This sets the environment variable for this Command Prompt session only. If you close cmd the setting is gone.
Why this is a good way to start
Running n8n locally using Node.js is an excellent starting point for anyone interested in exploring automation without incurring costs. This setup provides a hands-on experience with creating workflows, understanding nodes, and utilizing triggers, all within a familiar environment. As you become more comfortable and your needs grow, you can transition to more advanced setups like Docker or cloud hosting for continuous availability and public access. The community edition of n8n offers a robust platform for learning and development, making it an ideal choice for beginners and those looking to automate tasks efficiently.
Subscribe to my newsletter
Read articles from RITIK Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
