配置淘宝镜像

1.使用我们定制的 cnpm (gzip 压缩支持) 命令行工具代替默认的 npm:

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

2.把npm的register给永久设置过来就好了,这样使用cnpm或者npm就没差别了。(可选可不选)

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

– 配置后可通过下面方式来验证是否成功

npm config get registry

注意,不推荐不要使用方式2,因为把npm的镜像完全设为了淘宝的镜像,万一我们有些依赖包只有npm原始镜像里面才有,而淘宝里面没有,那就悲剧了。所以分开npm和cnpm是最好的。

修改

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章