[[Node.js FAQs]] Fixing the mysterious `registry.nlark.com` 404 in your Node project
Fixing the mysterious registry.nlark.com
404 in your Node project
The Error
1 | npm ERR! network request to https://registry.nlark.com/dom-to-image/download/dom-to-image-2.6.0.tgz failed |
You’ll usually see this when running npm install
(or yarn install
) on a project last updated a few years ago.
What’s going on?
registry.nlark.com
no longer exists.
The domain once pointed to Yuque’s private npm mirror (an Alibaba side-project). DNS now returns NXDOMAIN—meaning “this name is nowhere to be found”.- Old lockfiles hard-code the mirror.
Anything published between late 2019 – 2021 could haveregistry.nlark.com
baked intopackage-lock.json
oryarn.lock
.
The two-minute fix
-
Delete stale lockfiles
1
rm -f package-lock.json yarn.lock
-
Re-install with the default registry
1
npm install # or: yarn install
Fresh lockfiles will point at the official registry (
https://registry.npmjs.org/
) and you’re done.
Prefer not to lose lockfile history?
Search-and-replace the dead mirror with its modern twin, registry.npmmirror.com
(a CDN-backed clone run by Tsinghua & Alibaba).
1 | # macOS / Linux |
Then run npm install
again.