镜像切换

cnpm

https://www.jianshu.com/p/111e0fbc86e3open in new window

安装组件库


直接安装

用 yarn 直接安装暂时有问题,使用 yarn 安装推荐先且镜像源在进行安装

npm --registry http://nexus.eminxing.com/repository/npm-group/ install fbg-component
yarn add fbg-component registry http://nexus.eminxing.com/repository/npm-group/


npm --registry https://registry.npmjs.org install JSZip


pnpm --registry https://registry.npmjs.org install php-antdv-components@^1.0.23
pnpm --registry https://registry.npmjs.org install nrm

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

华为镜像
npm i --registry=https://mirrors.huaweicloud.com/repository/npm/
npm i --registry=https://registry.npm.taobao.org -g @vue/cli

忽略锁文件

https://blog.csdn.net/weixin_43558117/article/details/130343910open in new window

解决方案 2:增加超时时间

yarn add <yourPackage> --network-timeout 600000
yarn install --network-timeout 600000

解决方案 1:更换淘宝镜像

#查看代理
yarn config list
#删除代理
yarn config delete proxy
#更换淘宝镜像
yarn config set registry https://registry.npm.taobao.org

如果 yarn.lock 里是通过远程抓取不是本地 yarn 生成的的。这里 set registry 后执行 yarn install 依然走的是别的仓库。可以通过 yarn install --verbose 验证。可以通过忽略 lock 文件,同时 install 的时候加 registry 参数解决:yarn install --no-lockfile --registry https://registry.npmmirror.com/

yarn install --no-lockfile --registry https://registry.npmmirror.com/

安装的时候查看日志

yarn add --verbose --from=registry=https://registry.npmjs.org/ vite@2.7.8
yarn add --network-concurrency 1  --verbose --from=registry=https://registry.npmmirror.com/  vite@2.7.8

切换全局npm或者yarn数据源 (此项目是在公司的内网私有 npm 上的)

切换镜像源命令

npm config set registry http://nexus.eminxing.com/repository/npm-group/
pnpm config set registry https://registry.npm.taobao.org
pnpm config set registry https://registry.npmmirror.com

pnpm config set registry http://nexus.eminxing.com/repository/npm-group/


切换镜像源后再进行安装

npm  install fbg-component
yarn add fbg-component

恢复默认镜像地址

npm config set registry https://registry.npmjs.org
pnpm config set registry https://registry.npmjs.org
yarn config set registry https://registry.yarnpkg.com



查询当前镜像地址

npm get registry
yarn config get registry
//设置镜像地址
yarn config set registry https://registry.npmjs.org
yarn config set registry https://registry.npm.taobao.org

从 git submodule 中迁移

  • 上述命令安装以后, 需要删除代码目录中的  /src/components/fbg-components  和 根目录下的  .gitmodules  文件
  • main.js 中的原本依赖 submodule 直接通过 Vue.component()的组件, 需要修改为 vue.use()统一方式安装
Last Updated:
Contributors: 刘荣杰