Local Network NPM Installer
Built offline during the Tigray blackout: npm over a LAN, no internet
Local Network NPM Installer was born in the hardest circumstances I've worked in. During the war in Tigray, my region was cut off from the outside world, with no internet and no connection, for three years. I was there through all of it. And software doesn't stop needing the internet just because the internet is gone: npm install reaches for a registry that, for me, no longer existed.
The Story
So I adapted. The packages I needed weren't out on some server I couldn't reach. They were already sitting in a node_modules folder on a machine a few feet away, installed back when there was still a connection. The problem wasn't that the packages were missing. It was that I had no way to move them from one machine to another the way the tools expect.
So I wrote one. A small pair of Python scripts: one machine serves its node_modules over the local network, and any other machine pulls exactly what it needs, resolving dependencies recursively so nothing is left behind. No registry. No internet. Just the network in the room. Being cut off forced the design, and the constraint became the whole idea.
How It Works
- Host machine: serves its already-populated
node_modulesdirectory over plain HTTP, making every installed package available on the LAN - Client machine: connects to the host and pulls what it needs, following the dependency tree recursively so even complex projects mirror completely
npm_server.pyon the host,client.pyon the client, plus a lightweight HTTP file server. Any machine that already has the packages becomes the registry for everyone else
When connectivity finally returned to Tigray, I pushed the code to GitHub, which is why the repository's history begins long after the work itself did.
