This host proxies and caches package installs from
registry.npmjs.org. Point npm, yarn, or pnpm here to speed up
installs and cut outbound rate-limit hits. Replace mirror.example.com
below with this server's actual hostname.
Point the npm CLI at the mirror. This writes to your user-level
~/.npmrc and applies to every project unless overridden.
npm config set registry https://mirror.example.com/
# confirm it took
npm config get registry
To go back to the public registry later:
npm config set registry https://registry.npmjs.org/
Scope the mirror to a single project instead of your whole machine — safer for teams and reproducible in CI.
registry=https://mirror.example.com/
# scoped packages can point elsewhere if needed:
@yourscope:registry=https://mirror.example.com/
Commit this file so every teammate and CI job resolves packages through the mirror automatically.
yarn config set registry https://mirror.example.com/
npmRegistryServer: "https://mirror.example.com"
registry=https://mirror.example.com/
No repo changes needed — set this in your pipeline's environment and every npm/yarn/pnpm call picks it up.
export NPM_CONFIG_REGISTRY=https://mirror.example.com/
npm config get registry
curl -s https://mirror.example.com/-/ping -o /dev/null -w "%{http_code}\n"
# install something and time it
time npm install lodash --no-save
| Check | Expected result |
|---|---|
npm config get registry | Prints https://mirror.example.com/ |
GET /-/ping | 200 — mirror is reachable |
| First install of a package | Slower — cache miss, fetched from upstream and stored |
| Repeat install | Fast — served from local cache/tarball store |
registry.npmjs.org.
npm publish still goes straight to the real registry (or
wherever your publishConfig points) — this mirror only
accelerates installs. If it's served over plain HTTP internally, use
strict-ssl=false only on trusted internal networks, or
terminate TLS in front of it.