Overview
In this lesson, you'll learn how to install n8n on your local machine using Node.js and NPM. This approach is ideal for developers who want to build and test automation workflows locally before deploying them to a production environment. The tutorial covers installing Node.js, setting up n8n globally via NPM, starting the n8n instance, and activating free community features with a license key.
For those interested in alternative installation methods, you might want to explore how to Install n8n via Docker, which is often recommended for production environments.
Why Install n8n Locally?
Before diving into the installation steps, it’s important to understand why you might want to install n8n on your local machine:
- Full Control Over Your Data: You manage your own n8n instance without relying on third-party cloud services.
- Cost-Effective: Avoid subscription fees by handling your own server setup.
- Development and Testing: Ideal for building custom integrations and testing workflows before deploying to production.
- Learning Opportunity: Gain technical experience managing n8n and its environment.
However, keep in mind that running your own instance means you are responsible for server maintenance, updates, and security.
Installation Options for n8n
There are multiple ways to install n8n, each with its own use case:
Docker Image (Recommended for Production)
Suitable for production environments requiring scalability and isolation. Docker containers provide a lightweight and secure way to deploy n8n on cloud platforms like AWS, Digital Ocean, or Azure.Local Installation Using NPM (Great for Development)
This is the focus of this tutorial. You install n8n as a Node.js package on your machine, ideal for testing and development.Desktop App (Deprecated)
Previously available but no longer officially supported.
If you're new to n8n and automation, starting with the n8n cloud platform is recommended. Once you’re comfortable and want more control or to avoid cloud fees, shift to local installation.
Prerequisites
- A computer running Windows, macOS, or Linux.
- Basic familiarity with command-line interfaces (Terminal on macOS/Linux or Command Prompt/PowerShell on Windows).
- Administrative rights to install software on your machine.
- Internet access to download Node.js and n8n packages.
Step 1: Install Node.js and NPM
n8n runs on Node.js, so the first step is to install Node.js and its package manager, NPM.
How to Install Node.js
- Visit the official Node.js website: https://nodejs.org/ to access the Node.js documentation and download links.
- Download the latest LTS (Long Term Support) version suitable for your operating system.
- Run the installer and follow the prompts:
- Accept license agreement.
- Choose default installation options.
- Provide your system password if requested.
After installation, verify the installation:
Open your terminal or command prompt.
Check Node.js version:
node -vCheck NPM version:
npm -v
You should see version numbers for both, confirming successful installation.
Step 2: Install n8n Globally Using NPM
With Node.js and NPM installed, you can now install n8n globally. This makes the n8n command available system-wide.
Installation Command
Run the following command in your terminal:
npm install -g n8n
The
-gflag installs n8n globally.This process may take a few minutes.
If you encounter permissions errors, you might need to run the command as an administrator or use
sudoon macOS/Linux:sudo npm install -g n8n
For more detailed information, refer to the n8n NPM installation guide.
Step 3: Start n8n
Once installed, start your n8n instance by running:
n8n start
This command launches the n8n server.
You will see output indicating the server is running.
Press
O(the letter O) to automatically open n8n in your default web browser, or manually navigate to:http://localhost:5678
After launching, you can familiarize yourself with the interface by checking out the n8n Interface Walkthrough, which will help you navigate and use n8n effectively.
Step 4: Initial Setup and User Creation
The first time you access n8n, you’ll be prompted to create a user account.
- Enter your email address.
- Provide your name.
- Set a secure password.
- Optionally, check the box to receive security and product updates.
- Click Next.
You will then be asked a few optional questions about your company and usage:
- Company name (optional)
- Role (e.g., business owner)
- Company size
- How you heard about n8n
This helps the n8n team improve the product but can be skipped.
Step 5: Activate Free Community Edition License
After setup, n8n offers you a free license key that unlocks advanced features like:
- Workflow history
- Advanced debugging
- Execution search and tagging
- Folder organization
How to Get the License Key
- Enter your email to receive the free license key.
- Check your email inbox for the license key.
- In n8n, click on your user name on the top right, then select Settings.
- Click Enter activation key.
- Paste the license key from your email.
- Click Activate.
Your instance is now registered as the Community Edition with extended features enabled.
Step 6: Updating or Installing Specific Versions of n8n
You can update your local n8n installation to the latest stable version or install specific versions.
Update to Latest Stable Version
Run:
npm update -g n8n
Install a Specific Version
Use the @ symbol followed by the version number:
npm install -g n8n@0.126.1
Replace 0.126.1 with the desired version.
Install Beta or Next Version
To try alpha or beta releases (less stable), install with:
npm install -g n8n@next
Use this only if you want to test new features that are not yet stable.
Troubleshooting & Common Mistakes
Command Not Found: If
n8ncommand is not recognized after installation, ensure that NPM global packages are added to your system's PATH.Permission Errors on macOS/Linux: Use
sudobefore the install command or configure NPM to install global packages without sudo.Port 5678 Already in Use: If the default port is occupied, start n8n on a different port:
n8n start --port=5679Firewall Blocking Access: Ensure your firewall or antivirus software allows connections to localhost ports.
License Key Not Received: Check your spam or junk folder. If not received, request the key again.
Node.js Version Compatibility: Use the recommended LTS version of Node.js for best stability.
Additional Tips
- Use
npx n8nto try n8n without installing it globally. This runs n8n temporarily but is not suitable for persistent use. - When ready for production, consider using Docker for better scalability and isolation.
- Regularly check the official n8n docs for updates and best practices.
Once your instance is running, you can start creating automation workflows by following the Build Your First n8n Workflow tutorial to send welcome emails automatically.
Quick Reference Cheat Sheet
| Task | Command or Location |
|---|---|
| Check Node.js version | node -v |
| Check NPM version | npm -v |
| Install n8n globally | npm install -g n8n |
| Start n8n server | n8n start |
| Open n8n in browser | Press O after n8n start or visit localhost:5678 |
| Update n8n to latest stable | npm update -g n8n |
| Install specific n8n version | npm install -g n8n@<version> |
| Install beta/next version | npm install -g n8n@next |
| Enter license key | User menu → Settings → Enter activation key |
By following these steps, you will have a fully functional n8n instance running locally on your machine, ready for building and testing automation workflows. As shown in the video above, this setup is straightforward and a great way to get hands-on experience with n8n before moving to more complex deployment scenarios.