<p><img class="alignnone wp-image-3934" style="width: 100%; height: auto;" src="https://flowgenius.in/wp-content/uploads/2025/12/Blog-2-Cluster-6-1.png" alt="npm install n8n error fix guide" /></p>
<p style="text-align: center;">Complete fix guide for every npm install n8n error – ERESOLVE, EACCES, gyp ERR, EPERM, isolated-vm, and more</p>
<p> </p>
<hr />
<p> </p>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Who this is for:</strong> Developers and DevOps engineers who self‑host n8n and encounter npm install failures on Linux, macOS, Windows, or Apple Silicon. This guide covers every error you’ll hit running <code>npm install -g n8n</code> — from ERESOLVE peer dependency conflicts to gyp ERR node-gyp failures, EACCES permission denied, EPERM on Windows, isolated-vm compile errors, and node version mismatches. <strong>We cover this in detail in the</strong> n8n Installation Errors Guide.</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ QUICK DIAGNOSIS TABLE — EXPANDED WITH ALL 2025 ERRORS ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">Quick Diagnosis</h2>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">Symptom</th>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">Quick Fix (run in terminal)</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>npm ERR! code ELIFECYCLE</strong> or <strong>gyp ERR!</strong></td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Fix Node version & clean install</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Use a supported Node LTS
nvm install 20 && nvm use 20</pre>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Clean npm cache & reinstall
npm cache clean --force && rm -rf node_modules package-lock.json
npm install --production</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>EACCES permission denied</strong></td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Configure a user‑owned global npm directory</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Create a local npm prefix
mkdir "${HOME}/.npm-global"
npm config set prefix "${HOME}/.npm-global"</pre>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Add it to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="${HOME}/.npm-global/bin:$PATH"</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Missing <code>node‑gyp</code> or <code>python</code></strong></td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Install build prerequisites</strong></p>
<p><em>Ubuntu/Debian</em></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">sudo apt-get update && sudo apt-get install -y build-essential python3</pre>
<p><em>macOS (Homebrew)</em></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">brew install python@3.11 libtool automake pkg-config</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong><code>npm install</code> hangs / times out</strong></td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Force registry & verbose mode</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm config set registry https://registry.npmjs.org/ && npm install --verbose</pre>
</td>
</tr>
<p><!-- NEW ROWS ADDED --></p>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>npm ERR! code ERESOLVE</strong> — peer dependency conflict</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Use legacy peer dependency resolution</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm install -g n8n --legacy-peer-deps</pre>
<p style="margin: 8px 0 0 0; font-size: 0.9em;">If that fails, try: <code>npm install -g n8n --force</code> (last resort only)</p>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>EPERM: operation not permitted</strong> (Windows)</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Delete locked node_modules and reinstall as Administrator</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Run PowerShell as Administrator
Remove-Item -Recurse -Force node_modules
npm cache clean --force
npm install -g n8n</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>isolated-vm</strong> node-gyp compile failure (Node 22+/25)</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Switch to Node LTS 20 — isolated-vm does not support Node 25</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">nvm install 20 && nvm use 20
npm install -g n8n</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>npm error code ETARGET</strong> — No matching version found for @n8n/config</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Clear npm cache — stale registry metadata is the cause</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm cache clean --force
npm install -g n8n@latest</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Unsupported URL Type “workspace:*”</strong></td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Your npm is too old — upgrade npm first</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm install -g npm@latest
npm install -g n8n</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Hundreds of “npm warn deprecated”</strong> messages</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>These are warnings, not errors — n8n still installs</strong>. Deprecated package warnings from n8n’s dependencies (inflight, rimraf, glob, gauge) are cosmetic. If n8n starts after install, you can ignore them. If it fails, look for the actual <code>npm error code</code> line below the warnings.</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">*Run the block that matches your error, then retry <code>npm install</code> in the n8n project folder.*</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 1 — UNCHANGED + ROOT CAUSE TABLE UPDATED ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">1. Why the <code>npm install</code> step fails for n8n?</h2>
<p><strong>If you encounter any</strong> <a href="/docker-installation-error-n8n">docker installation error n8n</a><strong> resolve them before continuing with the setup.</strong></p>
<p style="margin-bottom: 2em; line-height: 1.9;">n8n compiles native modules (<code>sqlite3</code>, <code>bcrypt</code>, <code>@n8n.io/cli</code>, <code>isolated-vm</code>) with <strong>node‑gyp</strong>. Failures usually stem from one (or more) of the following root causes:</p>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">Root cause</th>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">Typical error message</th>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">What it means</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Node version mismatch</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>npm ERR! engine Unsupported engine</code></td>
<td style="padding: 13px; border: 1px solid #ddd;">n8n requires <strong>Node 20.19 to 24.x</strong> (LTS 20 or 22 recommended).</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Missing build tools</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>gyp ERR! stack Error: Can't find Python executable</code></td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>node‑gyp</code> needs Python 3 + C/C++ toolchain.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Permission problems</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>EACCES: permission denied</code></td>
<td style="padding: 13px; border: 1px solid #ddd;">npm cannot write to a directory you don’t own.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Corrupted cache / lockfile</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>npm ERR! Unexpected end of JSON input while parsing</code></td>
<td style="padding: 13px; border: 1px solid #ddd;">Cache or <code>package-lock.json</code> is out‑of‑date.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Network / registry issues</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>npm ERR! network request failed</code></td>
<td style="padding: 13px; border: 1px solid #ddd;">Proxy, firewall, or npm registry throttling.</td>
</tr>
<p><!-- NEW ROWS --></p>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Peer dependency conflict (npm 7+)</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>npm ERR! code ERESOLVE</code></td>
<td style="padding: 13px; border: 1px solid #ddd;">npm 7+ enforces strict peer deps. Use <code>--legacy-peer-deps</code> to bypass.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">isolated-vm ABI mismatch</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>npm error path .../isolated-vm</code> + gyp failure</td>
<td style="padding: 13px; border: 1px solid #ddd;">n8n’s sandbox module won’t compile on Node 22+ or 25. Use Node LTS 20.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Windows file lock (EPERM)</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>EPERM: operation not permitted, rmdir</code></td>
<td style="padding: 13px; border: 1px solid #ddd;">Antivirus or Windows file indexer is locking node_modules during install.</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Stale registry metadata (ETARGET)</td>
<td style="padding: 13px; border: 1px solid #ddd;"><code>npm error code ETARGET</code> — No matching version for @n8n/config</td>
<td style="padding: 13px; border: 1px solid #ddd;">npm’s local cache has a stale package manifest. Clear cache and retry.</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">Identifying the exact cause guides you to the correct remedy.</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 2 — NODE VERSION (UPDATED TO CURRENT RANGE) ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">2. Verify Node.js version compatibility</h2>
<p><strong>If you encounter any</strong> <a href="/windows-installation-error-n8n">windows installation error n8n</a><strong> resolve them before continuing with the setup.</strong></p>
<p style="margin-bottom: 2em; line-height: 1.9;"><em>n8n requires Node.js between <strong>20.19 and 24.x</strong> (inclusive). LTS 20 or LTS 22 are the recommended production choices. Node 18 is no longer supported. Node 25 causes isolated-vm compile failures.</em></p>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Check the current version</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">node -v # e.g. v20.19.0
npm -v # should be 10.x or higher</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Switch to a supported LTS (recommended 20.x or 22.x)</strong></p>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">OS</th>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">Command</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">macOS / Linux (nvm)</td>
<td style="padding: 13px; border: 1px solid #ddd;">
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">nvm install 20 && nvm use 20</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Windows (nvm‑windows)</td>
<td style="padding: 13px; border: 1px solid #ddd;">
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">nvm install 20.19.0
nvm use 20.19.0</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Apple Silicon / M1 / M2 Mac</td>
<td style="padding: 13px; border: 1px solid #ddd;">
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Install nvm first if not present
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install 20 && nvm use 20</pre>
</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">No version manager</td>
<td style="padding: 13px; border: 1px solid #ddd;">Download the LTS installer from <a href="https://nodejs.org">https://nodejs.org</a> and reinstall.</td>
</tr>
</tbody>
</table>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #ddd; font-style: italic;">
<p style="margin: 0; line-height: 1.9;">EEFA note: Pin the Node version in production via <code>.nvmrc</code>, Docker <code>FROM node:20‑bullseye</code>, or CI configuration to avoid accidental upgrades. Never rely on nvm inside a Docker container — base the image on the correct Node LTS tag instead.</p>
</blockquote>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ NEW SECTION 2A — ERESOLVE + --legacy-peer-deps (MAJOR ADDITION) ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">2a. Fix npm ERR! code ERESOLVE – the peer dependency conflict</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">This is the most searched npm install n8n error in 2024–2025. It happens because npm 7 introduced strict peer dependency enforcement. npm 6 treated peer dependency conflicts as warnings and installed anyway. npm 7+ treats them as hard errors and stops the install completely.</p>
<p style="margin-bottom: 2em; line-height: 1.9;">When you see this:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: n8n@x.x.x
npm ERR! Found: @langchain/core@1.x.x
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @langchain/core@"~0.1.29" from @getzep/zep-cloud</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">npm is saying: package A needs version 1.x of a dependency, but package B needs version 0.1.x, and it can’t install both in strict mode. n8n’s AI/LangChain integrations frequently trigger this because those packages update aggressively.</p>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Fix 1: Use <code>--legacy-peer-deps</code> (recommended)</h3>
<p style="margin-bottom: 1em; line-height: 1.9;">This flag tells npm to fall back to the old npm 6 resolution algorithm — peer dependency conflicts become warnings again, not errors. It is the safest ERESOLVE fix:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm install -g n8n --legacy-peer-deps</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">To set it permanently for a specific project (add a <code>.npmrc</code> file in the project root):</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">echo "legacy-peer-deps=true" > .npmrc
npm install -g n8n</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Fix 2: Use <code>--force</code> (last resort)</h3>
<p style="margin-bottom: 1em; line-height: 1.9;"><code>--force</code> bypasses all safety checks, not just peer deps. It can cause silent runtime breakage. Use it only in throw-away dev environments or if <code>--legacy-peer-deps</code> still fails:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm install -g n8n --force</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Fix 3: Update npm itself first</h3>
<p style="margin-bottom: 1em; line-height: 1.9;">Older npm 7.x and 8.x versions had bugs in their ERESOLVE handling that were fixed in later releases. Before anything else, try upgrading npm:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm install -g npm@latest
npm install -g n8n</pre>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #ddd; font-style: italic;">
<p style="margin: 0; line-height: 1.9;"><strong>–legacy-peer-deps vs –force:</strong> <code>--legacy-peer-deps</code> only relaxes peer dependency resolution — everything else stays strict. <code>--force</code> ignores all conflicts and warnings entirely. Always try <code>--legacy-peer-deps</code> first. If n8n starts and runs correctly, you’re done. These peer conflicts are almost always between optional AI/LangChain packages that don’t affect core workflow execution.</p>
</blockquote>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 3 — UNCHANGED ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">3. Clean the npm environment</h2>
<p style="margin-bottom: 2em; line-height: 1.9;"><em>A stale cache or mismatched lockfile often hides the real error.</em></p>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Purge the npm cache</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm cache clean --force</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Remove existing modules & lockfile</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">rm -rf node_modules package-lock.json</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Re‑install with reproducible lockfile handling</strong></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm ci # fails fast if lockfile mismatches
# fallback if no lockfile exists
npm install --production</pre>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #ddd; font-style: italic;">
<p style="margin: 0; line-height: 1.9;">npm ci guarantees a deterministic install, preventing version drift that can trigger native‑module compilation errors.</p>
</blockquote>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 4 — UNCHANGED ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">4. Install required build tools (node‑gyp prerequisites)</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">*Install the C/C++ toolchain and Python 3 for your platform.*</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.1 Ubuntu / Debian</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">sudo apt-get update
sudo apt-get install -y build-essential python3 pkg-config libsqlite3-dev</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.2 CentOS / RHEL</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">sudo yum groupinstall "Development Tools"
sudo yum install -y python3 gcc-c++ make</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.3 macOS (Homebrew)</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">brew install python@3.11 pkg-config libtool automake sqlite3</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.4 Windows</h3>
<p style="margin-bottom: 2em; line-height: 1.9;">1. Install the Windows build tools (run PowerShell as Administrator):</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm install --global --production windows-build-tools</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">2. Ensure <strong>Python 3</strong> is on the <code>PATH</code>.</p>
<p style="margin-bottom: 2em; line-height: 1.9;">3. Alternatively, install <strong>Visual Studio Build Tools</strong> (Desktop development with C++) and the official Python installer.</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 5 — UNCHANGED ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">5. Resolve permission errors</h2>
<h3 style="margin-bottom: 45px; line-height: 1.3;">5.1 Prefer project‑scoped installs</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Inside your n8n project folder
npm install --save-dev</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">5.2 Fix the global npm directory (no <code>sudo</code> needed)</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">mkdir "${HOME}/.npm-global"
npm config set prefix "${HOME}/.npm-global"</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">Add the new bin directory to your shell profile (<code>~/.bashrc</code>, <code>~/.zshrc</code>, etc.):</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">export PATH="${HOME}/.npm-global/bin:$PATH"</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">Reload the profile or open a new terminal.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">5.3 Verify the fix</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm root -g # should point to ~/.npm-global/lib/node_modules
npm install -g n8n # should succeed without EACCES</pre>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ NEW SECTION 5A — WINDOWS EPERM FIX ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">5a. Fix EPERM: operation not permitted on Windows</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">Windows users frequently hit this error during <code>npm install n8n</code> or after an interrupted install attempt:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'node_modules\@n8n\n8n-nodes-langchain\dist']
errno: -4048,
code: 'EPERM'</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">The cause is Windows Defender, antivirus software, or the Windows Search indexer locking files inside <code>node_modules</code> while npm tries to clean up. The fix:</p>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Step 1: Exclude node_modules from Windows Defender</h3>
<p style="margin-bottom: 1em; line-height: 1.9;">Go to <strong>Windows Security → Virus & threat protection → Manage settings → Exclusions</strong> and add your project folder.</p>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Step 2: Delete node_modules with elevated permissions</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Run PowerShell as Administrator
Remove-Item -Recurse -Force .\node_modules
Remove-Item -Force package-lock.json</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Step 3: Reinstall</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm cache clean --force
npm install -g n8n</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">If the error persists, try installing with <code>--legacy-peer-deps</code> or switching to Docker — Windows is the hardest environment for native npm module compilation and Docker eliminates all of these OS-level issues in one step.</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ NEW SECTION 5B — APPLE SILICON / M1 / M2 MAC ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">5b. Fix npm install n8n on Apple Silicon (M1 / M2 / M3 Mac)</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">Apple Silicon Macs running arm64 architecture have specific issues with native node-gyp module compilation. The most common errors after upgrading macOS or Node.js on M1/M2:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
# or
Error: dlopen(...node): tried: ... mach-o, but wrong architecture</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Fix 1: Install Xcode Command Line Tools</h3>
<p style="margin-bottom: 1em; line-height: 1.9;">This is the most common missing prerequisite on fresh or recently upgraded Macs:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">xcode-select --install</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Fix 2: Use the arm64 version of Node via nvm</h3>
<p style="margin-bottom: 1em; line-height: 1.9;">If you installed nvm or Node.js under Rosetta 2 (x86 emulation), native modules compiled for arm64 will fail. Reinstall nvm natively:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Check your current architecture
node -e "console.log(process.arch)"
# Should show: arm64 (not x64)
# If it shows x64, reinstall nvm in native arm64 terminal
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.zshrc
nvm install 20
nvm use 20</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Fix 3: Clear and reinstall after Node switch</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm cache clean --force
npm install -g n8n</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Fix 4: Use Docker (most reliable on M1/M2)</h3>
<p style="margin-bottom: 2em; line-height: 1.9;">If native compilation keeps failing on Apple Silicon, Docker with the official n8n image sidesteps all architecture issues entirely. The n8n Docker image is built for both amd64 and arm64:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">docker run -it --rm \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n</pre>
<blockquote style="margin: 0 0 2em 0; padding-left: 1em; border-left: 4px solid #ddd; font-style: italic;">
<p style="margin: 0; line-height: 1.9;">After upgrading macOS (e.g. to Sonoma or Sequoia), Xcode Command Line Tools sometimes need to be reinstalled even if they were previously present. Run <code>xcode-select --install</code> again before troubleshooting anything else.</p>
</blockquote>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ NEW SECTION 5C — isolated-vm COMPILE FAILURE ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">5c. Fix isolated-vm node-gyp compile failure (Node 22+ / Node 25)</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">As of 2025, the most common npm install n8n failure on fresh Linux servers is this:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm error path /home/user/.npm-global/lib/node_modules/n8n/node_modules/isolated-vm
npm error command failed
npm error command sh -c node-gyp-build || node-gyp rebuild --release -j max
npm error gyp info using node@25.7.0 | linux | x64
npm error gyp ERR! build error</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><code>isolated-vm</code> is n8n’s sandboxing module for Code nodes. It uses native C++ bindings that must be compiled for your exact Node.js ABI (application binary interface). The <code>isolated-vm</code> package does not support Node 25 (unstable) and has intermittent issues on Node 22. The fix is always the same: use Node LTS 20.</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;"># Step 1 — switch to Node LTS 20
nvm install 20 && nvm use 20
# Step 2 — verify
node -v # must show v20.x.x
# Step 3 — clean install
npm cache clean --force
npm install -g n8n</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">In Docker, use <code>node:20-bullseye</code> or the official n8n image, never <code>node:latest</code> which resolves to Node 25+ at time of writing.</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 6 — UNCHANGED ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">6. Alternative installation paths (when npm still fails)</h2>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">Method</th>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">When to use</th>
<th style="padding: 13px; border: 1px solid #ddd; text-align: left;">Command</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">npx n8n (no install)</td>
<td style="padding: 13px; border: 1px solid #ddd;">Quick test, CI pipelines</td>
<td style="padding: 13px; border: 1px solid #ddd;">npx n8n</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Yarn (fallback)</td>
<td style="padding: 13px; border: 1px solid #ddd;">npm lockfile corrupted, Yarn deterministic installs</td>
<td style="padding: 13px; border: 1px solid #ddd;">yarn install –production</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Docker (isolated environment)</td>
<td style="padding: 13px; border: 1px solid #ddd;">Persistent npm failures, need OS‑level isolation</td>
<td style="padding: 13px; border: 1px solid #ddd;">See page <a href="https://flowgenius.in/docker-installation-error-n8n/">Docker installation errors for n8n</a></td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd;">Manual binary (pre‑built)</td>
<td style="padding: 13px; border: 1px solid #ddd;">Edge‑case CI runners without build tools</td>
<td style="padding: 13px; border: 1px solid #ddd;">
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">curl -L https://github.com/n8n-io/n8n/releases/download/<version>/n8n-linux-x64.tar.gz | tar -xz && ./n8n</pre>
</td>
</tr>
</tbody>
</table>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 7 — UPDATED CHECKLIST (Node version row corrected) ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">7. Advanced troubleshooting checklist</h2>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="padding: 13px; border: 1px solid #ddd; text-align: center;">Steps</th>
<th style="padding: 13px; border: 1px solid #ddd;">Checklist item</th>
<th style="padding: 13px; border: 1px solid #ddd;">How to verify</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">1</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Node version</strong> is 20.19–24.x (prefer 20 LTS)</td>
<td style="padding: 13px; border: 1px solid #ddd;">node -v</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">2</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>npm version</strong> ≥ 10.0 (newer resolves many lockfile bugs)</td>
<td style="padding: 13px; border: 1px solid #ddd;">npm -v</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">3</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Cache cleaned</strong></td>
<td style="padding: 13px; border: 1px solid #ddd;">npm cache verify (should show 0 entries)</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">4</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Build tools</strong> installed (<code>gcc</code>, <code>make</code>, <code>python3</code>)</td>
<td style="padding: 13px; border: 1px solid #ddd;">gcc –version / python3 –version</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">5</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Permissions</strong> point to user‑owned directory</td>
<td style="padding: 13px; border: 1px solid #ddd;">npm config get prefix → should be under $HOME</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">6</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Network</strong> can reach registry (<code>curl https://registry.npmjs.org/npm</code>)</td>
<td style="padding: 13px; border: 1px solid #ddd;">HTTP 200 response</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">7</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Environment variable</strong> <code>npm_config_python</code> points to correct Python</td>
<td style="padding: 13px; border: 1px solid #ddd;">echo $npm_config_python</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">8</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Optional deps</strong> (e.g., <code>libsqlite3-dev</code>) present</td>
<td style="padding: 13px; border: 1px solid #ddd;">dpkg -l | grep sqlite3 (Debian)</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">9</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Lockfile</strong> matches <code>package.json</code> (<code>npm ci</code> succeeds)</td>
<td style="padding: 13px; border: 1px solid #ddd;">Run <code>npm ci</code> – should exit 0</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">10</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>No lingering processes</strong> locking files (<code>lsof | grep package-lock.json</code>)</td>
<td style="padding: 13px; border: 1px solid #ddd;">No output</td>
</tr>
<p><!-- NEW ROWS --></p>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">11</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>ERESOLVE</strong> — tried <code>--legacy-peer-deps</code></td>
<td style="padding: 13px; border: 1px solid #ddd;">npm install -g n8n –legacy-peer-deps</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">12</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>isolated-vm</strong> — Node version is not 25 or unstable</td>
<td style="padding: 13px; border: 1px solid #ddd;">node -v → must be 20.x or 22.x</td>
</tr>
<tr>
<td style="padding: 13px; border: 1px solid #ddd; text-align: center;">13</td>
<td style="padding: 13px; border: 1px solid #ddd;"><strong>Apple Silicon</strong> — Xcode CLI tools installed, node arch is arm64</td>
<td style="padding: 13px; border: 1px solid #ddd;">node -e “console.log(process.arch)” → arm64</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 2em; line-height: 1.9;">Address any failing item before re‑running <code>npm install</code>.</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 8 — ORIGINAL + NEW ERROR EXAMPLES ADDED ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">8. Real‑world error log examples & interpretation</h2>
<h3 style="margin-bottom: 45px; line-height: 1.3;">8.1 <code>node-gyp</code> cannot find Python</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Fix:</strong> Install Python 3 and expose it to <code>node‑gyp</code>:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">export PYTHON=$(which python3)
npm install</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">8.2 Engine mismatch</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node: expected ">=20.19 <25", got "18.20.0"</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Fix:</strong> Switch to Node 20 or 22 (see §2). Node 18 is no longer supported by n8n as of 2025.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">8.3 Permission denied</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /usr/local/lib/node_modules/n8n/package.json</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Fix:</strong> Use a user‑owned npm prefix (see §5) or, only if absolutely necessary, reinstall with <code>sudo</code> after understanding the security impact.</p>
<p><!-- NEW ERROR EXAMPLES --></p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">8.4 ERESOLVE peer dependency conflict</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! While resolving: n8n@1.x.x
npm ERR! Found: @langchain/core@1.1.8
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @langchain/core@"~0.1.29" from @getzep/zep-cloud@1.0.6</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Fix:</strong> Use <code>--legacy-peer-deps</code> (see §2a). This is an npm 7+ strictness issue, not an n8n bug.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">8.5 ETARGET – no matching version for @n8n/config</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm error code ETARGET
npm error notarget No matching version found for @n8n/config@1.43.0.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Fix:</strong> This is a stale npm cache issue — the local registry manifest is behind the published packages. Run:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm cache clean --force
npm install -g n8n@latest</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">8.6 Unsupported URL Type “workspace:*”</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm ERR! Unsupported URL Type "workspace:": workspace:*</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Fix:</strong> Your npm version is too old. The <code>workspace:</code> protocol requires npm 7 or higher. Upgrade npm first:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm install -g npm@latest
npm install -g n8n</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">8.7 EPERM: operation not permitted (Windows)</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm warn cleanup [Error: EPERM: operation not permitted,
rmdir 'D:\project\node_modules\@n8n\n8n-nodes-langchain\dist']
{ errno: -4048, code: 'EPERM', syscall: 'rmdir' }</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Fix:</strong> Windows Defender or file indexer is locking the folder. See §5a for the full fix sequence.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">8.8 Hundreds of “npm warn deprecated” — is my install broken?</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated gauge@4.0.4: This package is no longer supported.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported</pre>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>These are warnings, not failures.</strong> n8n’s dependency tree includes packages like <code>inflight</code>, <code>rimraf</code>, <code>glob</code>, and <code>gauge</code> that have issued deprecation notices. npm prints these as a courtesy — they do not stop the install from completing. If <code>npm install -g n8n</code> ends with <code>added X packages</code> and exits cleanly, n8n is installed correctly. Scroll past the warnings and look for an actual <code>npm error code</code> line if something is genuinely wrong.</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ NEW SECTION — VERIFY YOUR INSTALL SUCCEEDED ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">9. Verify your n8n install succeeded</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">After running <code>npm install -g n8n</code>, confirm it actually worked before assuming there is a problem. A successful global install looks like this in the terminal:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">added 638 packages in 2m
# No "npm error code" lines — deprecation warnings above are fine</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Check the installed version</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">n8n --version
# Expected output: 1.x.x (current release version)</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Start n8n and confirm it runs</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">n8n start
# Expected: "Editor is now accessible via: http://localhost:5678"</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Quick smoke test with npx (no global install required)</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">npx n8n
# Downloads and runs n8n without global install — useful for testing</pre>
<h3 style="margin-bottom: 20px; line-height: 1.3;">Confirm n8n is in PATH</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto;">which n8n # Linux/macOS — should return a path
where n8n # Windows — should return the install location</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">If <code>n8n --version</code> throws “command not found” after a clean install, your global npm bin directory is not in PATH. Re-check §5.2 to configure the user-owned npm directory and add it to your shell profile.</p>
<hr style="margin: 55px 0;" />
<p><!-- ============================================================ SECTION 10 — EEFA (was 9, renumbered + updated) ============================================================ --></p>
<h2 style="margin-bottom: 45px; line-height: 1.3;">10. EEFA (Expert Experience, Field‑tested Advice)</h2>
<ul style="line-height: 1.9; margin-bottom: 1.8em;">
<li>Never run <code>npm install</code> as root on a production server – it masks permission problems that surface later when the service runs under a non‑privileged user.</li>
<li>Pin the Node version in CI/CD (<code>.nvmrc</code>, Docker <code>FROM node:20-bullseye</code>) to eliminate “works on my machine” failures. Node 20 is the safest pin for n8n in 2025.</li>
<li>Cache native‑module binaries: after a successful install, copy the generated <code>node_modules</code> into a version‑controlled artifact (e.g., a Docker layer) to avoid recompilation on every deploy.</li>
<li>Alpine Linux caution – its <code>musl</code> libc can cause <code>node‑gyp</code> to fail for optional dependencies. Prefer the <code>node:20‑bullseye</code> base image, or install <code>musl-dev</code> and <code>python3</code> inside Alpine.</li>
<li>On Windows, always disable or add exclusions to Windows Defender for your project folder before running npm install on large packages like n8n. The file lock issues during install are almost always antivirus-related.</li>
<li><code>--legacy-peer-deps</code> is safe for n8n — the peer dependency conflicts are almost always in optional AI/LangChain packages that don’t affect core workflow execution. If n8n starts and your workflows run, the install is fine.</li>
<li>If you’re on a VPS with limited RAM (under 1 GB), npm install can silently fail due to OOM during native module compilation. Add a swap file or use the pre-built Docker image instead.</li>
</ul>
<p style="margin-bottom: 2em; line-height: 1.9;"><em>All commands assume a Unix‑like shell; adapt paths for Windows PowerShell as needed.</em></p>

Complete fix guide for every npm install n8n error – ERESOLVE, EACCES, gyp ERR, EPERM, isolated-vm, and more
Who this is for: Developers and DevOps engineers who self‑host n8n and encounter npm install failures on Linux, macOS, Windows, or Apple Silicon. This guide covers every error you’ll hit running npm install -g n8n — from ERESOLVE peer dependency conflicts to gyp ERR node-gyp failures, EACCES permission denied, EPERM on Windows, isolated-vm compile errors, and node version mismatches. We cover this in detail in the n8n Installation Errors Guide.
Quick Diagnosis
| Symptom |
Quick Fix (run in terminal) |
| npm ERR! code ELIFECYCLE or gyp ERR! |
Fix Node version & clean install
# Use a supported Node LTS
nvm install 20 && nvm use 20
# Clean npm cache & reinstall
npm cache clean --force && rm -rf node_modules package-lock.json
npm install --production
|
| EACCES permission denied |
Configure a user‑owned global npm directory
# Create a local npm prefix
mkdir "${HOME}/.npm-global"
npm config set prefix "${HOME}/.npm-global"
# Add it to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="${HOME}/.npm-global/bin:$PATH"
|
Missing node‑gyp or python |
Install build prerequisites
Ubuntu/Debian
sudo apt-get update && sudo apt-get install -y build-essential python3
macOS (Homebrew)
brew install python@3.11 libtool automake pkg-config
|
npm install hangs / times out |
Force registry & verbose mode
npm config set registry https://registry.npmjs.org/ && npm install --verbose
|
| npm ERR! code ERESOLVE — peer dependency conflict |
Use legacy peer dependency resolution
npm install -g n8n --legacy-peer-deps
If that fails, try: npm install -g n8n --force (last resort only)
|
| EPERM: operation not permitted (Windows) |
Delete locked node_modules and reinstall as Administrator
# Run PowerShell as Administrator
Remove-Item -Recurse -Force node_modules
npm cache clean --force
npm install -g n8n
|
| isolated-vm node-gyp compile failure (Node 22+/25) |
Switch to Node LTS 20 — isolated-vm does not support Node 25
nvm install 20 && nvm use 20
npm install -g n8n
|
| npm error code ETARGET — No matching version found for @n8n/config |
Clear npm cache — stale registry metadata is the cause
npm cache clean --force
npm install -g n8n@latest
|
| Unsupported URL Type “workspace:*” |
Your npm is too old — upgrade npm first
npm install -g npm@latest
npm install -g n8n
|
| Hundreds of “npm warn deprecated” messages |
These are warnings, not errors — n8n still installs. Deprecated package warnings from n8n’s dependencies (inflight, rimraf, glob, gauge) are cosmetic. If n8n starts after install, you can ignore them. If it fails, look for the actual npm error code line below the warnings. |
*Run the block that matches your error, then retry npm install in the n8n project folder.*
1. Why the npm install step fails for n8n?
If you encounter any docker installation error n8n resolve them before continuing with the setup.
n8n compiles native modules (sqlite3, bcrypt, @n8n.io/cli, isolated-vm) with node‑gyp. Failures usually stem from one (or more) of the following root causes:
| Root cause |
Typical error message |
What it means |
| Node version mismatch |
npm ERR! engine Unsupported engine |
n8n requires Node 20.19 to 24.x (LTS 20 or 22 recommended). |
| Missing build tools |
gyp ERR! stack Error: Can't find Python executable |
node‑gyp needs Python 3 + C/C++ toolchain. |
| Permission problems |
EACCES: permission denied |
npm cannot write to a directory you don’t own. |
| Corrupted cache / lockfile |
npm ERR! Unexpected end of JSON input while parsing |
Cache or package-lock.json is out‑of‑date. |
| Network / registry issues |
npm ERR! network request failed |
Proxy, firewall, or npm registry throttling. |
| Peer dependency conflict (npm 7+) |
npm ERR! code ERESOLVE |
npm 7+ enforces strict peer deps. Use --legacy-peer-deps to bypass. |
| isolated-vm ABI mismatch |
npm error path .../isolated-vm + gyp failure |
n8n’s sandbox module won’t compile on Node 22+ or 25. Use Node LTS 20. |
| Windows file lock (EPERM) |
EPERM: operation not permitted, rmdir |
Antivirus or Windows file indexer is locking node_modules during install. |
| Stale registry metadata (ETARGET) |
npm error code ETARGET — No matching version for @n8n/config |
npm’s local cache has a stale package manifest. Clear cache and retry. |
Identifying the exact cause guides you to the correct remedy.
2. Verify Node.js version compatibility
If you encounter any windows installation error n8n resolve them before continuing with the setup.
n8n requires Node.js between 20.19 and 24.x (inclusive). LTS 20 or LTS 22 are the recommended production choices. Node 18 is no longer supported. Node 25 causes isolated-vm compile failures.
Check the current version
node -v # e.g. v20.19.0
npm -v # should be 10.x or higher
Switch to a supported LTS (recommended 20.x or 22.x)
| OS |
Command |
| macOS / Linux (nvm) |
nvm install 20 && nvm use 20
|
| Windows (nvm‑windows) |
nvm install 20.19.0
nvm use 20.19.0
|
| Apple Silicon / M1 / M2 Mac |
# Install nvm first if not present
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install 20 && nvm use 20
|
| No version manager |
Download the LTS installer from https://nodejs.org and reinstall. |
EEFA note: Pin the Node version in production via .nvmrc, Docker FROM node:20‑bullseye, or CI configuration to avoid accidental upgrades. Never rely on nvm inside a Docker container — base the image on the correct Node LTS tag instead.
2a. Fix npm ERR! code ERESOLVE – the peer dependency conflict
This is the most searched npm install n8n error in 2024–2025. It happens because npm 7 introduced strict peer dependency enforcement. npm 6 treated peer dependency conflicts as warnings and installed anyway. npm 7+ treats them as hard errors and stops the install completely.
When you see this:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: n8n@x.x.x
npm ERR! Found: @langchain/core@1.x.x
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @langchain/core@"~0.1.29" from @getzep/zep-cloud
npm is saying: package A needs version 1.x of a dependency, but package B needs version 0.1.x, and it can’t install both in strict mode. n8n’s AI/LangChain integrations frequently trigger this because those packages update aggressively.
Fix 1: Use --legacy-peer-deps (recommended)
This flag tells npm to fall back to the old npm 6 resolution algorithm — peer dependency conflicts become warnings again, not errors. It is the safest ERESOLVE fix:
npm install -g n8n --legacy-peer-deps
To set it permanently for a specific project (add a .npmrc file in the project root):
echo "legacy-peer-deps=true" > .npmrc
npm install -g n8n
Fix 2: Use --force (last resort)
--force bypasses all safety checks, not just peer deps. It can cause silent runtime breakage. Use it only in throw-away dev environments or if --legacy-peer-deps still fails:
npm install -g n8n --force
Fix 3: Update npm itself first
Older npm 7.x and 8.x versions had bugs in their ERESOLVE handling that were fixed in later releases. Before anything else, try upgrading npm:
npm install -g npm@latest
npm install -g n8n
–legacy-peer-deps vs –force: --legacy-peer-deps only relaxes peer dependency resolution — everything else stays strict. --force ignores all conflicts and warnings entirely. Always try --legacy-peer-deps first. If n8n starts and runs correctly, you’re done. These peer conflicts are almost always between optional AI/LangChain packages that don’t affect core workflow execution.
3. Clean the npm environment
A stale cache or mismatched lockfile often hides the real error.
Purge the npm cache
npm cache clean --force
Remove existing modules & lockfile
rm -rf node_modules package-lock.json
Re‑install with reproducible lockfile handling
npm ci # fails fast if lockfile mismatches
# fallback if no lockfile exists
npm install --production
npm ci guarantees a deterministic install, preventing version drift that can trigger native‑module compilation errors.
4. Install required build tools (node‑gyp prerequisites)
*Install the C/C++ toolchain and Python 3 for your platform.*
4.1 Ubuntu / Debian
sudo apt-get update
sudo apt-get install -y build-essential python3 pkg-config libsqlite3-dev
4.2 CentOS / RHEL
sudo yum groupinstall "Development Tools"
sudo yum install -y python3 gcc-c++ make
4.3 macOS (Homebrew)
brew install python@3.11 pkg-config libtool automake sqlite3
4.4 Windows
1. Install the Windows build tools (run PowerShell as Administrator):
npm install --global --production windows-build-tools
2. Ensure Python 3 is on the PATH.
3. Alternatively, install Visual Studio Build Tools (Desktop development with C++) and the official Python installer.
5. Resolve permission errors
5.1 Prefer project‑scoped installs
# Inside your n8n project folder
npm install --save-dev
5.2 Fix the global npm directory (no sudo needed)
mkdir "${HOME}/.npm-global"
npm config set prefix "${HOME}/.npm-global"
Add the new bin directory to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export PATH="${HOME}/.npm-global/bin:$PATH"
Reload the profile or open a new terminal.
5.3 Verify the fix
npm root -g # should point to ~/.npm-global/lib/node_modules
npm install -g n8n # should succeed without EACCES
5a. Fix EPERM: operation not permitted on Windows
Windows users frequently hit this error during npm install n8n or after an interrupted install attempt:
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'node_modules\@n8n\n8n-nodes-langchain\dist']
errno: -4048,
code: 'EPERM'
The cause is Windows Defender, antivirus software, or the Windows Search indexer locking files inside node_modules while npm tries to clean up. The fix:
Step 1: Exclude node_modules from Windows Defender
Go to Windows Security → Virus & threat protection → Manage settings → Exclusions and add your project folder.
Step 2: Delete node_modules with elevated permissions
# Run PowerShell as Administrator
Remove-Item -Recurse -Force .\node_modules
Remove-Item -Force package-lock.json
Step 3: Reinstall
npm cache clean --force
npm install -g n8n
If the error persists, try installing with --legacy-peer-deps or switching to Docker — Windows is the hardest environment for native npm module compilation and Docker eliminates all of these OS-level issues in one step.
5b. Fix npm install n8n on Apple Silicon (M1 / M2 / M3 Mac)
Apple Silicon Macs running arm64 architecture have specific issues with native node-gyp module compilation. The most common errors after upgrading macOS or Node.js on M1/M2:
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
# or
Error: dlopen(...node): tried: ... mach-o, but wrong architecture
Fix 1: Install Xcode Command Line Tools
This is the most common missing prerequisite on fresh or recently upgraded Macs:
xcode-select --install
Fix 2: Use the arm64 version of Node via nvm
If you installed nvm or Node.js under Rosetta 2 (x86 emulation), native modules compiled for arm64 will fail. Reinstall nvm natively:
# Check your current architecture
node -e "console.log(process.arch)"
# Should show: arm64 (not x64)
# If it shows x64, reinstall nvm in native arm64 terminal
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.zshrc
nvm install 20
nvm use 20
Fix 3: Clear and reinstall after Node switch
npm cache clean --force
npm install -g n8n
Fix 4: Use Docker (most reliable on M1/M2)
If native compilation keeps failing on Apple Silicon, Docker with the official n8n image sidesteps all architecture issues entirely. The n8n Docker image is built for both amd64 and arm64:
docker run -it --rm \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
After upgrading macOS (e.g. to Sonoma or Sequoia), Xcode Command Line Tools sometimes need to be reinstalled even if they were previously present. Run xcode-select --install again before troubleshooting anything else.
5c. Fix isolated-vm node-gyp compile failure (Node 22+ / Node 25)
As of 2025, the most common npm install n8n failure on fresh Linux servers is this:
npm error path /home/user/.npm-global/lib/node_modules/n8n/node_modules/isolated-vm
npm error command failed
npm error command sh -c node-gyp-build || node-gyp rebuild --release -j max
npm error gyp info using node@25.7.0 | linux | x64
npm error gyp ERR! build error
isolated-vm is n8n’s sandboxing module for Code nodes. It uses native C++ bindings that must be compiled for your exact Node.js ABI (application binary interface). The isolated-vm package does not support Node 25 (unstable) and has intermittent issues on Node 22. The fix is always the same: use Node LTS 20.
# Step 1 — switch to Node LTS 20
nvm install 20 && nvm use 20
# Step 2 — verify
node -v # must show v20.x.x
# Step 3 — clean install
npm cache clean --force
npm install -g n8n
In Docker, use node:20-bullseye or the official n8n image, never node:latest which resolves to Node 25+ at time of writing.
6. Alternative installation paths (when npm still fails)
| Method |
When to use |
Command |
| npx n8n (no install) |
Quick test, CI pipelines |
npx n8n |
| Yarn (fallback) |
npm lockfile corrupted, Yarn deterministic installs |
yarn install –production |
| Docker (isolated environment) |
Persistent npm failures, need OS‑level isolation |
See page Docker installation errors for n8n |
| Manual binary (pre‑built) |
Edge‑case CI runners without build tools |
curl -L https://github.com/n8n-io/n8n/releases/download/<version>/n8n-linux-x64.tar.gz | tar -xz && ./n8n
|
7. Advanced troubleshooting checklist
| Steps |
Checklist item |
How to verify |
| 1 |
Node version is 20.19–24.x (prefer 20 LTS) |
node -v |
| 2 |
npm version ≥ 10.0 (newer resolves many lockfile bugs) |
npm -v |
| 3 |
Cache cleaned |
npm cache verify (should show 0 entries) |
| 4 |
Build tools installed (gcc, make, python3) |
gcc –version / python3 –version |
| 5 |
Permissions point to user‑owned directory |
npm config get prefix → should be under $HOME |
| 6 |
Network can reach registry (curl https://registry.npmjs.org/npm) |
HTTP 200 response |
| 7 |
Environment variable npm_config_python points to correct Python |
echo $npm_config_python |
| 8 |
Optional deps (e.g., libsqlite3-dev) present |
dpkg -l | grep sqlite3 (Debian) |
| 9 |
Lockfile matches package.json (npm ci succeeds) |
Run npm ci – should exit 0 |
| 10 |
No lingering processes locking files (lsof | grep package-lock.json) |
No output |
| 11 |
ERESOLVE — tried --legacy-peer-deps |
npm install -g n8n –legacy-peer-deps |
| 12 |
isolated-vm — Node version is not 25 or unstable |
node -v → must be 20.x or 22.x |
| 13 |
Apple Silicon — Xcode CLI tools installed, node arch is arm64 |
node -e “console.log(process.arch)” → arm64 |
Address any failing item before re‑running npm install.
8. Real‑world error log examples & interpretation
8.1 node-gyp cannot find Python
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
Fix: Install Python 3 and expose it to node‑gyp:
export PYTHON=$(which python3)
npm install
8.2 Engine mismatch
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node: expected ">=20.19 <25", got "18.20.0"
Fix: Switch to Node 20 or 22 (see §2). Node 18 is no longer supported by n8n as of 2025.
8.3 Permission denied
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /usr/local/lib/node_modules/n8n/package.json
Fix: Use a user‑owned npm prefix (see §5) or, only if absolutely necessary, reinstall with sudo after understanding the security impact.
8.4 ERESOLVE peer dependency conflict
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! While resolving: n8n@1.x.x
npm ERR! Found: @langchain/core@1.1.8
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @langchain/core@"~0.1.29" from @getzep/zep-cloud@1.0.6
Fix: Use --legacy-peer-deps (see §2a). This is an npm 7+ strictness issue, not an n8n bug.
8.5 ETARGET – no matching version for @n8n/config
npm error code ETARGET
npm error notarget No matching version found for @n8n/config@1.43.0.
npm error notarget In most cases you or one of your dependencies are requesting
npm error notarget a package version that doesn't exist.
Fix: This is a stale npm cache issue — the local registry manifest is behind the published packages. Run:
npm cache clean --force
npm install -g n8n@latest
8.6 Unsupported URL Type “workspace:*”
npm ERR! Unsupported URL Type "workspace:": workspace:*
Fix: Your npm version is too old. The workspace: protocol requires npm 7 or higher. Upgrade npm first:
npm install -g npm@latest
npm install -g n8n
8.7 EPERM: operation not permitted (Windows)
npm warn cleanup [Error: EPERM: operation not permitted,
rmdir 'D:\project\node_modules\@n8n\n8n-nodes-langchain\dist']
{ errno: -4048, code: 'EPERM', syscall: 'rmdir' }
Fix: Windows Defender or file indexer is locking the folder. See §5a for the full fix sequence.
8.8 Hundreds of “npm warn deprecated” — is my install broken?
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated gauge@4.0.4: This package is no longer supported.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
These are warnings, not failures. n8n’s dependency tree includes packages like inflight, rimraf, glob, and gauge that have issued deprecation notices. npm prints these as a courtesy — they do not stop the install from completing. If npm install -g n8n ends with added X packages and exits cleanly, n8n is installed correctly. Scroll past the warnings and look for an actual npm error code line if something is genuinely wrong.
9. Verify your n8n install succeeded
After running npm install -g n8n, confirm it actually worked before assuming there is a problem. A successful global install looks like this in the terminal:
added 638 packages in 2m
# No "npm error code" lines — deprecation warnings above are fine
Check the installed version
n8n --version
# Expected output: 1.x.x (current release version)
Start n8n and confirm it runs
n8n start
# Expected: "Editor is now accessible via: http://localhost:5678"
Quick smoke test with npx (no global install required)
npx n8n
# Downloads and runs n8n without global install — useful for testing
Confirm n8n is in PATH
which n8n # Linux/macOS — should return a path
where n8n # Windows — should return the install location
If n8n --version throws “command not found” after a clean install, your global npm bin directory is not in PATH. Re-check §5.2 to configure the user-owned npm directory and add it to your shell profile.
10. EEFA (Expert Experience, Field‑tested Advice)
- Never run
npm install as root on a production server – it masks permission problems that surface later when the service runs under a non‑privileged user.
- Pin the Node version in CI/CD (
.nvmrc, Docker FROM node:20-bullseye) to eliminate “works on my machine” failures. Node 20 is the safest pin for n8n in 2025.
- Cache native‑module binaries: after a successful install, copy the generated
node_modules into a version‑controlled artifact (e.g., a Docker layer) to avoid recompilation on every deploy.
- Alpine Linux caution – its
musl libc can cause node‑gyp to fail for optional dependencies. Prefer the node:20‑bullseye base image, or install musl-dev and python3 inside Alpine.
- On Windows, always disable or add exclusions to Windows Defender for your project folder before running npm install on large packages like n8n. The file lock issues during install are almost always antivirus-related.
--legacy-peer-deps is safe for n8n — the peer dependency conflicts are almost always in optional AI/LangChain packages that don’t affect core workflow execution. If n8n starts and your workflows run, the install is fine.
- If you’re on a VPS with limited RAM (under 1 GB), npm install can silently fail due to OOM during native module compilation. Add a swap file or use the pre-built Docker image instead.
All commands assume a Unix‑like shell; adapt paths for Windows PowerShell as needed.