您的位置:首页 > 产品设计

npm 更改为淘宝镜像的方法

2018-04-19 15:08 561 查看


1、命令行临时使用指定镜像(淘宝)

npm --registry https://registry.npm.taobao.org install express

2、命令行永久更改使用指定镜像(淘宝)

npm config set registry https://registry.npm.taobao.org

以后 npm install express 默认使用指定(淘宝)镜像

3、通过npm配置文件直接修改,本质和第2条一样,配置文件位置(windows环境)为C盘下的.npmrc文件(百度很容易查到文件路径),MAC没试过。

4、使用淘宝 NPM 镜像(参考 http://www.runoob.com/nodejs/nodejs-npm.html)

命令行输入

$ npm install -g cnpm --registry=https://registry.npm.taobao.org

这样就可以使用 cnpm 命令来安装模块了: cnpm installexpress

查看目前使用的npm镜像的方法:

npm config get registry

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: