yarn安装包时报错error Error: certificate has expired

安装教程:

配置镜像地址:

bash 复制代码
npm config set registry https://registry.npmmirror.com

//镜像:https://developer.aliyun.com/mirror/NPM

安装yarn:

bash 复制代码
npm install --global yarn

查看版本:

bash 复制代码
yarn --version

卸载:

bash 复制代码
npm uninstall -g yarn

安装固定版本yarn:

bash 复制代码
npm install -g yarn@1.22.17

错误1:error Error: certificate has expired

解决方案:

输入:yarn config list
如果是true,输入:yarn config set strict-ssl false

解决问题。

错误2:info There appears to be trouble with your network connection. Retrying...

解决方案:

方法1:

更换淘宝镜像:

bash 复制代码
yarn config set registry https://registry.npmmirror.com

移除原代理:

bash 复制代码
yarn config delete proxy
npm config rm proxy
npm config rm https-proxy

方法2:

直接删除项目根目录的yarn.lock文件,再设置yarn国内镜像:

bash 复制代码
yarn config set registry https://registry.npmmirror.com

再安装 yarn:

bash 复制代码
yarn install

方法3.

将 yarn.lock 中的 https://registry.yarnpkg.com 换成 https://registry.npmmirror.com

如果遇到其他问题,然后试了各种方法未解决,比如一直报超时

info There appears to be trouble with your network connection. Retrying...

最后若还是解决不了:

请打开C:\Windows\System32\cmd.exe右键管理员模式运行,执行yarn install。

相关推荐
索西25 分钟前
Vue 响应式原理
vue.js
焦小风Zephyr28 分钟前
Vue3组件通信:父子相传
vue.js
Sky_Ax40 分钟前
实现一个时间轴组件
vue.js
RainbowSea2 小时前
伙伴匹配系统(移动端 H5 网站(APP 风格)基于Spring Boot 后端 + Vue3 - 05
vue.js·spring boot·后端
文艺理科生3 小时前
Nuxt 组件渲染进阶:服务端与客户端组件的协作艺术
前端·javascript·vue.js
天客3 小时前
Vue3.5 + Element-Plus 二次封装 el-table、el-form、el-descriptions
前端·vue.js
XiaoMu_0014 小时前
【Vue vs React:前端框架深度对比分析】
vue.js·react.js·前端框架
吃饭了吗4 小时前
elementplus组件文本框设置前缀
前端·vue.js·elementui
前端小巷子4 小时前
从 Vue 2 到 Vue 3
前端·vue.js·面试
GDAL4 小时前
v-model 入门教程
前端·javascript·vue.js