首页 > 编程知识 正文

淘宝镜像是什么意思啊,淘宝镜像有什么用

时间:2023-05-03 05:46:24 阅读:202778 作者:927

npm 安装淘宝镜像、查看镜像设置以及设置返回原镜像

原文链接: npm安装淘宝镜像和查看镜像设置

1.通过cnpm使用淘宝镜像:

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

2.将npm设置为淘宝镜像:

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

3.查看npm镜像设置:

npm config get registry

4.查看cnpm镜像设置:

cnpm config get registry

5.查看cnpm版本号:

cnpm -v

6.单次使用:

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

b:永久替换:

在开发react-native的时候,不要使用cnpm,cnpm安装的模块路径比较奇怪,packager不能正常识别。

所以,为了方便开发,我们最好是直接永久使用淘宝的镜像源。

直接命令行的设置

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

手动修改设置

1.打开.npmrc文件(C:Program Filesnodejsnode_modulesnpmnpmrc,没有的话可以使用git命令行建一个( touch .npmrc),用cmd命令建会报错)
2.增加 registry =https://registry.npm.taobao.org 即可。

如果需要恢复成原来的官方地址只需要执行如下命令:

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

检测是否安装成功:

npm config get registry

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。