How to Run n8n on Localhost

n8n is an open-source workflow automation tool that can be run locally on your machine for development, testing, or personal use. Below are step-by-step instructions to get n8n running on your localhost using the most common and straightforward method: installation via npm (Node.js package manager).


Prerequisites

  • Node.js and npm must be installed on your system.
    • To check, run node -v and npm -v in your terminal or command prompt. If not installed, download and install Node.js from the official website[4][3].

Installation Steps

  1. Open your terminal or command prompt.

  2. Install n8n globally using npm:

npm install n8n -g

This command installs n8n globally, making it accessible from anywhere in your terminal[1][2][3][4].

  1. Start n8n:
n8n

or

n8n start

This will launch the n8n service locally[1][2][4].

  1. Access the n8n UI:
  • By default, n8n runs on http://localhost:5678.
  • Open your web browser and navigate to http://localhost:5678 to access the n8n interface[4][5].
  1. Set up your admin account:
  • On first launch, n8n may prompt you to set up an admin account with your email and password[4].

Optional: Running with Docker

If you prefer Docker, you can also run n8n using a Docker container. This is especially useful for isolating dependencies and managing environments.

  • Example docker-compose.yml snippet:
version: '3'
  services:
    n8n:
      image: n8nio/n8n
      ports:
        - "5678:5678"
      environment:
        - N8N_BASIC_AUTH_ACTIVE=true
        - N8N_BASIC_AUTH_USER=admin
        - N8N_BASIC_AUTH_PASSWORD=yourpassword
      volumes:
        - ~/.n8n:/home/node/.n8n
  • Then run: docker-compose up -d
  • Access at http://localhost:5678[1][5].

Troubleshooting

  • If you cannot access n8n at localhost:5678, check that the process is running and that your firewall or security software is not blocking the port[8].
  • For custom node development, you may need to link your node package and restart n8n[2].

Summary Table: Methods to Run n8n Locally

Method Command to Start Access URL Notes
npm n8n or n8n start http://localhost:5678 Easiest for most users
Docker docker-compose up -d http://localhost:5678 Good for isolation

Further Reading

  • For advanced configuration, scaling, and security, consult the official n8n hosting documentation[6].
  • If you want to test custom nodes, see the n8n documentation for local node development steps[2].

You now have a running n8n instance on your local machine, ready for workflow automation!

Citations:
[1] https://support.dropsolid.io/integrations/n8n/installing_n8n_locally/
[2] https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally/
[3] https://www.youtube.com/watch?v=pBy0HZ2ohOA
[4] https://www.youtube.com/watch?v=YHsN8jb8A8M
[5] https://www.youtube.com/watch?v=kq5bmrjPPAY
[6] https://docs.n8n.io/hosting/
[7] https://www.reddit.com/r/n8n/comments/1gm0uy6/beginner_seeking_advice_best_setup_for_self/
[8] https://community.n8n.io/t/cant-access-n8n-on-localhost-5678-using-docker-desktop-linux/43168
[9] https://www.youtube.com/watch?v=8MpfbI_9wzM
[10] https://community.n8n.io/t/n8n-running-on-localhost-but-not-from-the-internet/61942