简体   繁体   English

如何使用NPM镜像

[英]How to use an NPM Mirror

The npm registry is down again, resulting in npm install not working. npm注册表再次关闭,导致npm install无法正常工作。

Question: How do we use npm to pull packages from npm mirrors? 问题:我们如何使用npm从npm镜像中提取包? Are there any recommended npm mirrors? 有没有推荐的npm镜子?

use the npm mirror 使用npm镜像

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重置此项

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. 您还可以查看此要点以获取有关上述解决方案的更多信息。

Here is a Gist with what seems to be complete instructions for setting up a mirror, with a demo mirror/example. 这是一个Gist,带有一个似乎是设置镜子的完整说明,带有演示镜像/示例。 . Not sure if that person's mirror is still running, but the example provided seems simple enough: 不确定该人的镜像是否仍在运行,但提供的示例似乎很简单:

$ npm set registry http://domain.of.your.npm.mirror.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM