前端如何配置镜像源

mac2024-03-31  29

配置镜像源(npm、cnpm、yarn)

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

npm config get registry

安装cnpm (不推荐使用) npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm

nrm (可选 如果已经做了1 就不需要设置了)

npm i nrm -g

nrm -V 验证版本

nrm ls | list 查看可切换镜像源

nrm use cnpm | npm | taobao taobao 是最快的 建议使用

yarn

npm i yarn -g

yarn -v

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

yarn config get registry

npm 常用命令

npm install 包名 -g | --save-dev(-D) --save(-S)

npm uninstall 包名 -g | --save-dev(-D) --save(-S)

yarn 常用命令

yarn add 包名 -g | --save-dev(-D) --save(-S)

yarn remove 包名 -g | --save-dev(-D) --save(-S)

最新回复(0)