n8n on Windows – fix node-gyp build errors and EPERM operation not permitted

Step by Step Guide to solve n8n Windows Installation Errors

 

Who this is for: Windows developers or DevOps engineers who need a reliable, production‑grade n8n installation on Windows 10/11 (64‑bit). We cover this in detail in the n8n Installation Errors Guide.


Quick Diagnosis (run in an elevated PowerShell session)

  1. Bypass PowerShell’s execution policy for this session
    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
  2. Install the Visual C++ 2015‑2022 Redistributable silently
    Start-Process "https://aka.ms/vs/17/release/vc_redist.x64.exe" `
      -ArgumentList "/quiet /norestart" -Wait
  3. Register n8n as a Windows service
    n8n.exe service install
    n8n.exe service start
  4. Confirm the service is running
    Get-Service n8n

If the service reports Running, the most common Windows‑specific installation issues are resolved.


1. Why Windows Needs Special Handling

If you encounter any docker installation error n8n resolve them before continuing with the setup.

Windows‑specific factor What it breaks Typical symptom
PowerShell execution policy Scripts (n8n.ps1) are blocked “File cannot be loaded because running scripts is disabled on this system.”
Visual C++ Redistributables Native Node modules (e.g., bcrypt, sharp) fail to load “The specified module could not be found.”
Service registration n8n.exe cannot be installed as a Windows service “Service n8n does not exist.”
Node.js version mismatch Incompatible binary modules “ERR_MODULE_NOT_FOUND” or “Invalid hook call.”
PATH/Environment variables n8n command not recognized n8n‘ is not recognized as an internal or external command

Understanding these dependencies lets you isolate the root cause quickly, without re‑reading the generic pillar article.


2. Fix #1 – PowerShell Execution Policy

If you encounter any npm installation failure n8n resolve them before continuing with the setup.

What the error looks like

File C:\Users\you\n8n.ps1 cannot be loaded because running scripts is disabled on this system.

Step‑by‑step resolution

  1. Open PowerShell as Administrator – Win + X → Windows PowerShell (Admin).
  2. Temporarily bypass the policy – this affects only the current session:
    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
  3. Re‑run the n8n installer
    npm install -g n8n
  4. Verify the installation
    n8n --version

EEFA note: Do not change the machine‑wide policy (-Scope LocalMachine) unless you control the host. A permanent policy can expose the system to malicious scripts.


3. Fix #2 – Install Visual C++ Redistributables

Typical error messages

  • Error: The specified module could not be found.
  • Error: Cannot find module 'bcrypt/lib/binding/.../bcrypt_lib.node'

These stem from missing Microsoft Visual C++ 2015‑2022 Redistributable (x64).

Automated silent install (PowerShell)

$vcUrl = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
$vcInstaller = "$env:TEMP\vc_redist.x64.exe"
Invoke-WebRequest -Uri $vcUrl -OutFile $vcInstaller
Start-Process -FilePath $vcInstaller -ArgumentList "/quiet /norestart" -Wait
Remove-Item $vcInstaller

Manual fallback (if corporate proxy blocks the script)

  1. Open a browser on the Windows machine.
  2. Navigate to the Microsoft download page: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
  3. Download vc_redist.x64.exe and run it as administrator.

EEFA warning: After installation, restart the machine if “module not found” errors persist. Some services cache the DLL load list.


4. Fix #3 – Register n8n as a Windows Service

Running n8n as a service ensures it survives reboots and runs under a dedicated account.

Common failure messages

  • Error: Service n8n does not exist.
  • Access is denied (0x5) when attempting to start the service.

Service registration steps

  1. Navigate to the n8n binary folder (usually C:\Users\\AppData\Roaming\npm\node_modules\n8n\dist)
    cd (npm root -g)\n8n\dist
  2. Install the service – this creates a service called **n8n** that runs under **LocalSystem** by default:
    .\n8n.exe service install
  3. Start the service
    .\n8n.exe service start
  4. Confirm status
    Get-Service n8n

    Expected output: Running.

Production‑grade service configuration (low‑privilege account)

# Create a low‑privilege user (run once)
net user n8nUser StrongP@ssw0rd! /add
net localgroup "Users" n8nUser /add

# Re‑install the service under that user
.\n8n.exe service uninstall
.\n8n.exe service install --username n8nUser --password StrongP@ssw0rd!
.\n8n.exe service start

Why this matters: Running n8n under LocalSystem gives it unrestricted file‑system access, which is a security risk in multi‑tenant environments.


5. Additional Windows‑Specific Checks

Check Command Expected result Fix if not met
Node.js version node -v v18.x or newer (LTS) Download latest LTS from https://nodejs.org
npm version npm -v 9.x or newer npm install -g npm@latest
PATH includes npm global bin echo $Env:Path Contains %AppData%\npm Add via **System Properties → Environment Variables**
Firewall allows port 5678 netsh advfirewall firewall show rule name=all | findstr 5678 Rule exists & enabled New-NetFirewallRule -DisplayName "n8n 5678" -Direction Inbound -LocalPort 5678 -Protocol TCP -Action Allow
Service Controller can query n8n sc query n8n STATE: RUNNING or STOPPED Re‑install service (see §4)

Run the checklist after applying fixes to ensure a clean environment.


6. Verifying a Healthy Installation

  1. Check n8n version
    n8n --version
  2. Verify service status
    Get-Service n8n | Format-Table Name, Status, StartType
  3. Perform a quick API health check
    Invoke-RestMethod -Uri http://localhost:5678/api/v1/workflows

A successful JSON array response confirms that n8n is up and listening on the default port.


7. Frequently Asked Questions

Question Short Answer
Do I need Docker on Windows to run n8n? No. n8n runs natively via Node.js or as a Windows service. Docker is an alternative for isolation.
Can I use PowerShell 7 instead of Windows PowerShell? Yes. All commands work in PowerShell 7+, but you must still run the session as Administrator for service registration.
Why does npm install -g n8n sometimes hang? Often caused by an outdated npm registry cache. Run npm cache clean --force before reinstalling.
Is the Visual C++ redistributable required for every n8n version? Starting with n8n 0.220, native modules (e.g., bcrypt) require the 2015‑2022 redistributable. Older versions may work with 2015‑2019 only.
My service starts but stops after a few seconds – why? Check the n8n logs (%USERPROFILE%\.n8n\logs\n8n.log). Common cause: missing EXECUTIONS_PROCESS=main env var or insufficient permissions on the data folder.

All commands are intended for Windows 10 / 11 (64‑bit). Adjust paths accordingly for older Windows Server versions.

Leave a Comment

Your email address will not be published. Required fields are marked *