Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use an NPM Mirror

The npm registry is down again, resulting in npm install not working.

Question: How do we use npm to pull packages from npm mirrors? Are there any recommended npm mirrors?

like image 542
Nyxynyx Avatar asked Nov 14 '13 00:11

Nyxynyx


People also ask

What is npm mirror?

npm-registry-mirror is a utility for mirroring a subset of npm packages from another npm registry. It syncs all of the dependencies for a particular node module and writes them to the local filesystem so that a simple webserver can behave like a read-only For more information about how to use this package see README.

What is Verdaccio npm?

Verdaccio is a simple, zero-config-required local private NPM registry. No need for an entire database just to get started. Verdaccio comes out of the box with its own tiny database, and the ability to proxy other registries (eg. npmjs.org), also introduces caching the downloaded modules along the way.

Where do I put Npmrc?

Per-project config file npmrc file in the root of the project (ie, a sibling of node_modules and package. json ) will set config values specific to this project.


1 Answers

use the npm mirror

npm set registry http://ec2-46-137-149-160.eu-west-1.compute.amazonaws.com

you can reset this later with npm set registry

npm set registry https://registry.npmjs.org/

then use it normally:

npm install express

You can also see this gist for more information on the above solution.

like image 199
sam100rav Avatar answered Sep 28 '22 19:09

sam100rav