<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MrL5z2k0</title>
    <description>The latest articles on DEV Community by MrL5z2k0 (@mrl5z2k0).</description>
    <link>https://dev.to/mrl5z2k0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4264181%2Fe710920c-8984-49b8-ad7a-ac23f89c119d.jpg</url>
      <title>DEV Community: MrL5z2k0</title>
      <link>https://dev.to/mrl5z2k0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mrl5z2k0"/>
    <language>en</language>
    <item>
      <title>One Proxy, Three Tools, Three Different Failures: A Decision Tree for npm, Docker, and prebuild-install on Locked-Down Networks</title>
      <dc:creator>MrL5z2k0</dc:creator>
      <pubDate>Wed, 25 Nov 2026 09:00:17 +0000</pubDate>
      <link>https://dev.to/mrl5z2k0/one-proxy-three-tools-three-different-failures-a-decision-tree-for-npm-docker-and-2k71</link>
      <guid>https://dev.to/mrl5z2k0/one-proxy-three-tools-three-different-failures-a-decision-tree-for-npm-docker-and-2k71</guid>
      <description>&lt;p&gt;This week I set up tooling on a corporate Windows machine behind a local proxy — &lt;code&gt;127.0.0.1:7890&lt;/code&gt;, the standard arrangement for developers who need to reach blocked registries. Three tools needed network access. All three failed, and each one failed &lt;strong&gt;differently&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt;: &lt;code&gt;docker pull&lt;/code&gt; → &lt;code&gt;context deadline exceeded&lt;/code&gt; after 17 seconds&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;npm&lt;/strong&gt;: worked, but 8+ seconds per registry round-trip&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;prebuild-install&lt;/strong&gt; (the native-binary fetcher inside &lt;code&gt;sqlite3&lt;/code&gt;): &lt;code&gt;Client network socket disconnected before secure TLS connection was established&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Same machine. Same network. Same proxy. The reason is the one thing most "just set your proxy" tutorials skip: &lt;strong&gt;every tool decides for itself whether to honor the system proxy, read environment variables, or consult its own config file.&lt;/strong&gt; "Setting the proxy on the machine" doesn't exist. You set it per layer.&lt;/p&gt;

&lt;p&gt;Here's the decision tree I ended up with, followed by the layers explained.&lt;/p&gt;

&lt;h2&gt;
  
  
  The decision tree
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A network-dependent tool fails on a proxied/censored network
│
├─ Step 0: Does the proxy itself work?
│   curl -x http://127.0.0.1:7890 -sI https://registry.npmjs.org -m 8
│   ├─ 200 → proxy is fine; your TOOL is the problem (go to Step 1)
│   └─ 000/connection refused → proxy isn't running / wrong port. Fix this first.
│
├─ Step 1: Which tool is failing? Proxy support is per-tool:
│   │
│   ├─ npm / node scripts
│   │   ├─ Reads: HTTPS_PROXY / HTTP_PROXY env vars, npm config
│   │   ├─ Slow but working? → switch registry one-off:
│   │   │     npm install &amp;lt;pkg&amp;gt; --registry=https://registry.npmmirror.com
│   │   │     (no global config change, no side effects)
│   │   └─ Totally blocked? → export HTTPS_PROXY=http://127.0.0.1:7890
│   │
│   ├─ Docker (docker pull)
│   │   ├─ Reads: NOTHING from your shell. The daemon is a separate service.
│   │   ├─ "context deadline exceeded" = daemon can't reach the registry
│   │   └─ Fix: Docker Desktop → Settings → Resources → Proxies
│   │         set HTTP/HTTPS proxy → Apply &amp;amp; Restart (restart required)
│   │
│   ├─ prebuild-install / node-gyp fetchers (native binaries)
│   │   ├─ Claim to read npm_config_proxy / HTTPS_PROXY — sometimes don't
│   │   │   (my session: still died mid-TLS with proxy env set)
│   │   └─ Reliable fallback: don't fight the tool. curl the binary
│   │         from GitHub Releases yourself and drop it in place.
│   │
│   └─ curl — always explicit, always honest:
│         curl -x http://127.0.0.1:7890 -L -o file.tar.gz &amp;lt;url&amp;gt;
│
└─ Step 2: It "works through the proxy" but behaves weirdly?
    ├─ Shared exit IP → GitHub API 403 rate limit
    │     {"message":"API rate limit exceeded for 203.190.x.x"}
    │     Workaround: scrape the HTML asset page instead of the API:
    │     https://github.com/&amp;lt;org&amp;gt;/&amp;lt;repo&amp;gt;/releases/expanded_assets/&amp;lt;tag&amp;gt;
    └─ You set a global proxy and localhost calls now break?
          → export NO_PROXY=localhost,127.0.0.1  (webhooks, local servers)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Layer 0: establish ground truth with curl before touching anything
&lt;/h2&gt;

&lt;p&gt;Every debugging session on a proxied network opens with the same question: &lt;strong&gt;is the proxy alive, and can it reach the target?&lt;/strong&gt; Don't reason from the failing tool's output — tools muffle and relabel network errors, the same way a &lt;code&gt;catch&lt;/code&gt; block turns "binary missing" into "package not found."&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Baseline: does the proxy work at all?&lt;/span&gt;
curl -s -o /dev/null -w &lt;span class="s2"&gt;"%{http_code} %{time_total}s\n"&lt;/span&gt; \
  -x http://127.0.0.1:7890 https://registry.npmjs.org -m 8
&lt;span class="c"&gt;# → 200 0.4s   proxy fine, tool problem&lt;/span&gt;

&lt;span class="c"&gt;# Compare: direct connection&lt;/span&gt;
curl -s -o /dev/null -w &lt;span class="s2"&gt;"%{http_code} %{time_total}s\n"&lt;/span&gt; \
  https://registry.npmjs.org -m 8
&lt;span class="c"&gt;# → 200 8.0s   direct works but throttled → mirror or proxy, either is fine&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;-m 8&lt;/code&gt; matters more than it looks: on a broken route, a slow failure is worse than a fast one. And the gap between those two numbers tells you whether you're facing a &lt;em&gt;reachability&lt;/em&gt; problem (use the proxy) or merely a &lt;em&gt;throughput&lt;/em&gt; one (use a mirror).&lt;/p&gt;

&lt;p&gt;curl earns its place here because it never lies about proxies. &lt;code&gt;-x&lt;/code&gt; is explicit, per-command, and leaves no residue in any config file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer 1: npm — the polite one
&lt;/h2&gt;

&lt;p&gt;npm reads proxy configuration from multiple places and mostly behaves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;HTTP_PROXY&lt;/code&gt; / &lt;code&gt;HTTPS_PROXY&lt;/code&gt; environment variables&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm config&lt;/code&gt; (&lt;code&gt;npm config set proxy http://...&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But before routing npm through a proxy, check whether you need one at all. On networks where the default registry is merely slow rather than blocked, the cleaner fix is a &lt;strong&gt;one-off registry flag&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;pkg&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --registry=https://registry.npmmirror.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice this is deliberately &lt;em&gt;not&lt;/em&gt; &lt;code&gt;npm config set registry&lt;/code&gt;. A one-off flag changes nothing persistent: your other projects keep their behavior, and you never find out six months later that some internal tool was quietly hitting a mirror. Persistent config is a decision. A flag is an experiment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer 2: Docker — the daemon that ignores you
&lt;/h2&gt;

&lt;p&gt;This was the most instructive failure of my week:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ docker pull n8nio/n8n
Unable to find image locally
docker: Error response from daemon: Get &lt;span class="s2"&gt;"https://registry-1.docker.io/v2/"&lt;/span&gt;:
context deadline exceeded &lt;span class="o"&gt;(&lt;/span&gt;Client.Timeout exceeded &lt;span class="k"&gt;while&lt;/span&gt; awaiting headers&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My shell had the proxy exported. curl through the proxy worked fine. So why did Docker choke?&lt;/p&gt;

&lt;p&gt;Because &lt;code&gt;docker pull&lt;/code&gt; isn't executed by your shell. It's a &lt;strong&gt;request to the Docker daemon&lt;/strong&gt; — a separate Windows service living in its own environment. Your &lt;code&gt;export HTTPS_PROXY&lt;/code&gt; never reaches it. The daemon tries &lt;code&gt;registry-1.docker.io&lt;/code&gt; directly, slams into the corporate firewall, and times out with &lt;code&gt;context deadline exceeded&lt;/code&gt; — which, notice, is itself a relabeled error: the wording suggests a timeout problem, when the actual problem is "no route."&lt;/p&gt;

&lt;p&gt;The fix lives in the daemon's settings, not your shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Docker Desktop → Settings → Resources → Proxies
  Manual proxy configuration:
    Web Server (HTTP) proxy:  http://127.0.0.1:7890
    Secure Web Server (HTTPS) proxy:  http://127.0.0.1:7890
  → Apply &amp;amp; Restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The restart is not optional. The daemon reads its proxy config at startup; change the settings on a running daemon and nothing changes until it comes back up.&lt;/p&gt;

&lt;p&gt;One Windows-specific detail worth knowing: &lt;code&gt;127.0.0.1&lt;/code&gt; in Docker Desktop's proxy settings correctly refers to the host machine. This is one of the few places where localhost-in-a-config "just works" for Docker on Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer 3: prebuild-install — when the tool's proxy support betrays you
&lt;/h2&gt;

&lt;p&gt;Native modules (&lt;code&gt;sqlite3&lt;/code&gt;, &lt;code&gt;bcrypt&lt;/code&gt;, &lt;code&gt;canvas&lt;/code&gt;, &lt;code&gt;sharp&lt;/code&gt;) download prebuilt binaries from GitHub Releases during &lt;code&gt;npm install&lt;/code&gt;. When that download fails, &lt;strong&gt;npm install still exits 0&lt;/strong&gt;. The failure detonates later, at runtime — I wrote a whole separate post about that trap.&lt;/p&gt;

&lt;p&gt;The fetcher (&lt;code&gt;prebuild-install&lt;/code&gt;) documents proxy support via &lt;code&gt;npm_config_proxy&lt;/code&gt; / &lt;code&gt;npm_config_https_proxy&lt;/code&gt;. In my session, with both set, it still died:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;prebuild-install warn install Client network socket disconnected
before secure TLS connection was established
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That message usually means the connection was reset mid-handshake — the signature of a direct connection to a blocked host, i.e. &lt;strong&gt;the proxy config never took effect for that request&lt;/strong&gt;. Whether that's a bug in the version I had, or some subtlety about which env var it reads in which mode, I honestly can't say.&lt;/p&gt;

&lt;p&gt;What I can say: the reliable move is to stop negotiating with the tool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Find the real asset name (N-API naming, NOT node-vXXX — see below)&lt;/span&gt;
curl -sSL &lt;span class="s2"&gt;"https://github.com/TryGhost/node-sqlite3/releases/expanded_assets/v5.1.7"&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -o &lt;span class="s1"&gt;'href="[^"]*"'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; grep -i &lt;span class="s2"&gt;"win32-x64"&lt;/span&gt;

&lt;span class="c"&gt;# 2. Fetch it with curl, which you've already proven works&lt;/span&gt;
curl -sSL -x http://127.0.0.1:7890 -o binding.tar.gz \
  &lt;span class="s2"&gt;"https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz"&lt;/span&gt;

&lt;span class="c"&gt;# 3. Place it: the tarball contains build/Release/node_sqlite3.node,&lt;/span&gt;
&lt;span class="c"&gt;#    so extract at the PACKAGE ROOT — not into build/Release&lt;/span&gt;
tar -xzf binding.tar.gz -C .../node_modules/sqlite3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ten minutes of curl beats an evening of spelunking through prebuild-install's source. Fallbacks are allowed to be manual.&lt;/p&gt;

&lt;h2&gt;
  
  
  The trap inside the trap: shared proxy exit IPs
&lt;/h2&gt;

&lt;p&gt;After the TLS failures, I tried the GitHub API to look up release assets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl https://api.github.com/repos/TryGhost/node-sqlite3/releases/tags/v5.1.7
{"message":"API rate limit exceeded for 203.190.x.x. ..."}   HTTP 403
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The proxy's exit IP is shared, and anonymous GitHub API limits are per-IP. Somebody else on that exit node had burned through the quota. Two fixes: authenticate the request with a personal token, or — no auth, no rate limit — request the HTML fragment the release page renders its asset list from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://github.com/&amp;lt;org&amp;gt;/&amp;lt;repo&amp;gt;/releases/expanded_assets/&amp;lt;tag&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Grep it for &lt;code&gt;href=&lt;/code&gt; and you have every asset name. This has become my default on shared-IP networks, precisely because it skips the rate-limit conversation entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't forget NO_PROXY
&lt;/h2&gt;

&lt;p&gt;Once you export a proxy for a session — or launch a long-running tool with one — every request goes through it. Including the ones that shouldn't:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;HTTP_PROXY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://127.0.0.1:7890
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;HTTPS_PROXY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://127.0.0.1:7890
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;NO_PROXY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;localhost,127.0.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without &lt;code&gt;NO_PROXY&lt;/code&gt;, calls to your own local servers and webhooks (&lt;code&gt;http://localhost:5678/...&lt;/code&gt;) get routed through the proxy, which slows them down at best and breaks them outright at worst. On a proxy whose exit IP isn't your machine, "localhost" stops meaning localhost. Two seconds of setup, and an entire class of "why is my local dev server suddenly weird" mysteries never happens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The checklist (copy-paste diagnosis)
&lt;/h2&gt;

&lt;p&gt;Next time a tool can't reach the network on a proxied machine, run these in order. By the end, you'll know which layer was lying to you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Proxy alive and reaching the target?&lt;/span&gt;
curl -x http://127.0.0.1:7890 -sI https://registry.npmjs.org -m 8

&lt;span class="c"&gt;# 2. Direct route viable (slow counts as viable)?&lt;/span&gt;
curl -s -o /dev/null -w &lt;span class="s2"&gt;"%{http_code} %{time_total}s\n"&lt;/span&gt; https://registry.npmjs.org -m 8

&lt;span class="c"&gt;# 3. npm: prefer a one-off mirror over global config changes&lt;/span&gt;
npm install &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;pkg&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --registry=https://registry.npmmirror.com

&lt;span class="c"&gt;# 4. Docker: the daemon needs its OWN proxy settings + restart&lt;/span&gt;
&lt;span class="c"&gt;#    Docker Desktop → Settings → Resources → Proxies&lt;/span&gt;

&lt;span class="c"&gt;# 5. Binary fetchers that ignore proxy config → curl + tar, manually&lt;/span&gt;

&lt;span class="c"&gt;# 6. GitHub API 403 on a shared exit IP → use expanded_assets HTML&lt;/span&gt;

&lt;span class="c"&gt;# 7. Always: NO_PROXY=localhost,127.0.0.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The one-sentence version of everything above: &lt;strong&gt;there is no such thing as "setting the proxy on this machine" — only per-tool proxy settings, so diagnose the tool, not the network.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>npm</category>
      <category>docker</category>
      <category>networking</category>
    </item>
    <item>
      <title>Fixing "SQLite package has not been found installed" — When npm Errors Lie to You</title>
      <dc:creator>MrL5z2k0</dc:creator>
      <pubDate>Wed, 25 Nov 2026 08:56:32 +0000</pubDate>
      <link>https://dev.to/mrl5z2k0/fixing-sqlite-package-has-not-been-found-installed-when-npm-errors-lie-to-you-iec</link>
      <guid>https://dev.to/mrl5z2k0/fixing-sqlite-package-has-not-been-found-installed-when-npm-errors-lie-to-you-iec</guid>
      <description>&lt;p&gt;Earlier this week I installed a globally distributed Node.js tool — &lt;code&gt;n8n&lt;/code&gt;, via &lt;code&gt;npm install -g&lt;/code&gt; — on Windows. It crashed on startup with this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Initial database connection attempt 1 failed: SQLite package has not been
found installed. Try to install it: npm install sqlite3 --save.
Retrying in 1000ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Five retries. Then it gave up for good:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: There was an error initializing DB
DriverPackageNotInstalledError: SQLite package has not been found installed.
Try to install it: npm install sqlite3 --save
    at SqliteLibrary.loadLibrary (...\@n8n\typeorm\dist\driver\sqlite-pooled\SqliteLibrary.js:30:19)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, here's the part that still annoys me: &lt;strong&gt;sqlite3 was installed. Twice, in fact.&lt;/strong&gt; Once globally, once nested inside the tool itself. The error message was lying — and the lie cost me a full hour, because I kept believing it.&lt;/p&gt;

&lt;p&gt;This post is that debugging session, plus the method I walked away with. The method generalizes: it works for any native module that "cannot be found" when you know perfectly well it exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Windows, Node v22, npm 10&lt;/li&gt;
&lt;li&gt;A globally installed CLI tool that vendors &lt;code&gt;sqlite3&lt;/code&gt; as a nested dependency&lt;/li&gt;
&lt;li&gt;A terminal, so you can fire off &lt;code&gt;node -e&lt;/code&gt; one-liners&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1 — Symptom: verify the package before touching anything
&lt;/h2&gt;

&lt;p&gt;The error tells you to run &lt;code&gt;npm install sqlite3 --save&lt;/code&gt;. Don't. Not yet. First find out what actually exists:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm ls -g sqlite3
&lt;span class="c"&gt;# └── sqlite3@6.0.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Installed. So why does the tool insist otherwise?&lt;/p&gt;

&lt;p&gt;The answer sits in the throwing code. I opened &lt;code&gt;SqliteLibrary.js&lt;/code&gt; and found this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;loadLibrary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sqlite&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;driver&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'sqlite3'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sqlite&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sqlite&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;verbose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DriverPackageNotInstalledError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SQLite'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'sqlite3'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;That &lt;code&gt;catch&lt;/code&gt; swallows everything.&lt;/strong&gt; &lt;em&gt;Any&lt;/em&gt; failure inside &lt;code&gt;require('sqlite3')&lt;/code&gt; — including "the native binary that lives inside the package is missing" — gets relabeled as "the package is not installed." A loading failure and an installation failure produce the exact same misleading sentence.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Lesson 1: when a wrapper catches &lt;code&gt;require()&lt;/code&gt; and translates it into "package not installed," the package is rarely the problem. The loader is.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 2 — Hypothesis: two ways this can be true
&lt;/h2&gt;

&lt;p&gt;Suppose the package exists but &lt;code&gt;require&lt;/code&gt; fails anyway. Only two explanations are possible:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Resolution picks a different copy&lt;/strong&gt; than the one that works — nested &lt;code&gt;node_modules&lt;/code&gt; shadowing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The resolved copy exists, but its native binary doesn't&lt;/strong&gt; — a &lt;code&gt;.node&lt;/code&gt; file that never made it down at install time.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One command distinguishes them. Ask Node what it &lt;em&gt;would&lt;/em&gt; load, from the perspective of the code that's failing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node -e &lt;span class="s2"&gt;"console.log(require.resolve('sqlite3', {
  paths: ['C:/path/to/the/tool/node_modules/@n8n/typeorm']
}))"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Out comes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\...\node_modules\n8n\node_modules\sqlite3\lib\sqlite3.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There it is. The tool ships its own &lt;strong&gt;nested&lt;/strong&gt; &lt;code&gt;sqlite3&lt;/code&gt; (5.1.7) inside its &lt;code&gt;node_modules&lt;/code&gt;, and Node's resolution walks the ancestor chain starting from the failing file — so it hits the nested copy &lt;strong&gt;before&lt;/strong&gt; my global 6.0.1. The global copy I confirmed in Step 1? Never even a candidate.&lt;/p&gt;

&lt;p&gt;Hypothesis 1, dead. Everything now points at hypothesis 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 — Verify: load each copy directly
&lt;/h2&gt;

&lt;p&gt;Load both copies in isolation and compare:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# global copy — loads fine&lt;/span&gt;
node -e &lt;span class="s2"&gt;"require('C:/.../node_modules/sqlite3'); console.log('OK')"&lt;/span&gt;

&lt;span class="c"&gt;# nested copy — the real failure, finally speaking for itself&lt;/span&gt;
node -e &lt;span class="s2"&gt;"require('C:/.../node_modules/n8n/node_modules/sqlite3')"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The nested copy's error is nothing like what the tool reported:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Could not locate the bindings file. Tried:
 → ...\sqlite3\build\node_sqlite3.node
 → ...\sqlite3\build\Debug\node_sqlite3.node
 → ...\sqlite3\build\Release\node_sqlite3.node
 → ...\sqlite3\out\Release\node_sqlite3.node
 → ...\sqlite3\lib\binding\node-v127-win32-x64\node_sqlite3.node
 ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No &lt;code&gt;build/Release/node_sqlite3.node&lt;/code&gt; anywhere. The nested package shipped &lt;strong&gt;without its native binary&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Why? Because &lt;code&gt;sqlite3&lt;/code&gt;'s install script downloads a prebuilt binary from GitHub Releases at install time — and I was on a corporate network where that download failed &lt;strong&gt;silently&lt;/strong&gt;. &lt;code&gt;npm install -g&lt;/code&gt; reported success. The missing binary only surfaced hours later, at runtime, wearing a disguise.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Lesson 2: a silent network failure during install becomes a misleading error at runtime. The farther apart those two moments are, the harder the debugging gets.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 4 — Fix: fetch the prebuilt binary manually
&lt;/h2&gt;

&lt;p&gt;I tried three shortcuts before the real fix. Keeping them in — each one is a trap worth knowing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trap 1 — &lt;code&gt;prebuild-install&lt;/code&gt; doesn't fix it:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; .../n8n/node_modules/sqlite3
&lt;span class="nv"&gt;npm_config_proxy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://127.0.0.1:7890 npx --yes prebuild-install
&lt;span class="c"&gt;# warn install Client network socket disconnected before secure TLS&lt;/span&gt;
&lt;span class="c"&gt;# connection was established&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The binary fetcher needs GitHub access itself, and its proxy configuration refused to cooperate. Same wall, different tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trap 2 — guessing the release URL 404s:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The prebuilt binaries live on the project's GitHub Releases. I guessed the asset name using the old Node ABI convention:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/node-v127-win32-x64.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What that downloads is a 9-byte file containing &lt;code&gt;Not Found&lt;/code&gt;. Modern &lt;code&gt;sqlite3&lt;/code&gt; builds are &lt;strong&gt;N-API&lt;/strong&gt; builds, so the assets are named &lt;code&gt;napi-vX&lt;/code&gt;, not &lt;code&gt;node-vXXX&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;del&gt;&lt;code&gt;node-v127-win32-x64.tar.gz&lt;/code&gt;&lt;/del&gt; (my guess — doesn't exist)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz&lt;/code&gt; (real asset)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;N-API binaries are ABI-stable across Node versions — which is exactly why the Node version disappeared from the filename. Guess the old convention and you'll 404 every time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trap 3 — the GitHub API may be rate-limited:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The obvious next move is listing release assets through the API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.github.com/repos/TryGhost/node-sqlite3/releases/tags/v5.1.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your proxy exit IP is shared — and on any corporate proxy or VPN, it is — you can inherit some stranger's exhausted rate limit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"API rate limit exceeded for 203.190.x.x. (But here's the good
news: Authenticated requests get a higher rate limit...)"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The workaround that actually worked: scrape the release page's asset list, which carries no rate limit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sSL &lt;span class="s2"&gt;"https://github.com/TryGhost/node-sqlite3/releases/expanded_assets/v5.1.7"&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -o &lt;span class="s1"&gt;'href="[^"]*"'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; grep -i &lt;span class="s2"&gt;"win32-x64"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Real asset names, no API involved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix itself&lt;/strong&gt; (through a proxy that works):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; .../n8n/node_modules/sqlite3   &lt;span class="c"&gt;# the NESTED copy, not your global one&lt;/span&gt;

curl -sSL -x http://127.0.0.1:7890 -o binding.tar.gz \
  &lt;span class="s2"&gt;"https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz"&lt;/span&gt;

tar -xzf binding.tar.gz -C .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One more trap hides in that last line. The tarball already contains &lt;code&gt;build/Release/node_sqlite3.node&lt;/code&gt; — so if you extract with &lt;code&gt;-C build/Release&lt;/code&gt; (which felt perfectly logical to me for about thirty seconds), you end up with &lt;code&gt;build/Release/build/Release/...&lt;/code&gt; and the same "could not locate bindings" error. &lt;strong&gt;Extract to the package root.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Then verify — no need to launch the whole tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node -e &lt;span class="s2"&gt;"require('./lib/sqlite3.js'); console.log('fixed')"&lt;/span&gt;
&lt;span class="c"&gt;# fixed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next &lt;code&gt;n8n start&lt;/code&gt; ran to completion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5 — Generalize: a checklist for lying "package not found" errors
&lt;/h2&gt;

&lt;p&gt;Any time a native module — anything that loads a &lt;code&gt;.node&lt;/code&gt; binary: &lt;code&gt;sqlite3&lt;/code&gt;, &lt;code&gt;bcrypt&lt;/code&gt;, &lt;code&gt;canvas&lt;/code&gt;, &lt;code&gt;sharp&lt;/code&gt;, &lt;code&gt;node-pty&lt;/code&gt;... — claims it isn't installed:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Don't reinstall.&lt;/strong&gt; Check &lt;code&gt;npm ls -g &amp;lt;pkg&amp;gt;&lt;/code&gt; (or the lockfile) first. If it's there, the error is lying, and you're debugging a loader, not an installer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask what resolution actually picks&lt;/strong&gt; — &lt;code&gt;require.resolve(pkg, { paths: [dir-of-the-failing-code] })&lt;/code&gt;. Nested copies shadow your global/parent install; you need to know which copy is losing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load each candidate copy directly&lt;/strong&gt; with &lt;code&gt;node -e "require(...)"&lt;/code&gt;. The direct error ("Could not locate the bindings file") beats the wrapper's relabeled one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;If a native binary is missing&lt;/strong&gt;, the install-time download failed silently. Fetch it manually from the project's GitHub Releases — remembering that assets are &lt;code&gt;napi-vX&lt;/code&gt; (N-API) today, not the &lt;code&gt;node-vXXX&lt;/code&gt; ABI names older guides mention.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On restricted networks&lt;/strong&gt;, the binary fetcher (&lt;code&gt;prebuild-install&lt;/code&gt;) may fail where a plain &lt;code&gt;curl -x proxy&lt;/code&gt; succeeds. Don't fight the tool. Use curl, place the file yourself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the throwing code&lt;/strong&gt; when an error smells wrong. Ten lines of &lt;code&gt;try/catch&lt;/code&gt; explained the whole mystery at a glance.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;"Package not found" from a wrapper's &lt;code&gt;catch&lt;/code&gt; block is a &lt;em&gt;category&lt;/em&gt; of failure, not a diagnosis.&lt;/li&gt;
&lt;li&gt;Node resolves modules along the ancestor chain from the &lt;strong&gt;requiring file&lt;/strong&gt; — nested copies always shadow yours, and &lt;code&gt;npm install -g &amp;lt;pkg&amp;gt;&lt;/code&gt; will never fix a nested copy.&lt;/li&gt;
&lt;li&gt;Silent install-time failures on restricted networks surface later as runtime lies. The gap between cause and symptom is what makes them hard.&lt;/li&gt;
&lt;li&gt;When the GitHub API rate-limits you behind a shared proxy IP, the &lt;code&gt;expanded_assets&lt;/code&gt; HTML page is your friend.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The meta-lesson I'm keeping from this one: &lt;strong&gt;when an error tells you a package is missing, the package is rarely the problem — the loader is.&lt;/strong&gt; Verify before you reinstall.&lt;/p&gt;

</description>
      <category>node</category>
      <category>debugging</category>
      <category>windows</category>
      <category>npm</category>
    </item>
  </channel>
</rss>
