1.问题恢复在国内使用npm安装时,会很慢。npminstall推荐使用淘宝的镜像仓库替换原来的镜像仓库(镜像仓库是一个npm下载源,换成国内的下载源,下载速度会提高很多)2.解决方法还好,里面有几个镜像站点我们可以用的中国,速度很快,而且镜像站点会实时更新,为我们节省了很多时间。如何更改本机的来源?(1)【暂定】通过config配置指向国内镜像源#配置指向源$npmconfigsetregistryhttp://registry.npm.taobao.org(2)【暂定】通过npm命令#安装时临时指定$npm--registryhttp://registry.cnpmjs.orginfoexpress(3)永久使用$npmconfigsetregistryhttps://registry.npm.taobao.org(4)永久修改镜像源查看npm配置$npmconfiglist#查看配置的其他方式$npmconfiggetglobalconfig$npmconfigls-l找到并打开配置文件:~/.npmrc写入配置:registry=https://registry.npm。taobao.org3.验证设置是否成功npmconfiggetregistry#ORnpminfoexpress4.重要提醒不建议使用cnpm,会出现各种莫名其妙的问题。5.其他镜像开源镜像:http://npm.taobao.org/mirrorsNode.js镜像:http://npm.taobao.org/mirrors/nodealinode镜像:http://npm.taobao.org/mirrors/alinodephantomjs镜像:http://npm.taobao.org/mirrors/phantomjsChromeDriver镜像:http://npm.taobao.org/mirrors/chromedriverOperaDriver镜像:http://npm.taobao.org/mirrors/operadriverSelenium镜像:http://npm.taobao.org/mirrors/seleniumNode.js文档镜像:http://npm.taobao.org/mirrors/node/latest/docs/api/index.htmlNPM镜像:https://npm.taobao.org/mirrors/npm/electron镜像:https://npm.taobao.org/mirrors/electron/node-inspector镜像:https://npm.taobao.org/mirrors/node-inspector/
