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。

相关推荐
匠心网络科技1 天前
前端框架-Vue双向绑定核心机制全解析
前端·javascript·vue.js·前端框架
刘一说1 天前
Vue3 组合式 API(Composition API):逻辑复用的革命性实践
vue.js·vue
xixixin_2 天前
【vue】中字符串与数组转换:为何首选 Computed 而非 Methods?
前端·javascript·vue.js
i_am_a_div_日积月累_2 天前
el-drawer注册全局点击事件无效;el-dialog注册全局点击事件无效
javascript·vue.js·elementui
啥都不懂的小小白2 天前
Vue第四篇:组件通信 + DOM 更新 + 过渡动画
vue.js·全局事件通信
向下的大树2 天前
VUE父子组件传参中的触发时机问题:异步场景下的解决方案
前端·javascript·vue.js
英俊潇洒美少年2 天前
vue2中使用节流防抖函数时,使用的vue状态始终是初始化的数据
前端·javascript·vue.js
刘一说2 天前
Vue3响应式原理重构:从Object.defineProperty到Proxy的革命性升级
javascript·vue.js·重构
切糕师学AI2 天前
Vue 中的生命周期钩子
前端·javascript·vue.js
暴富暴富暴富啦啦啦2 天前
使用 v-html 仅渲染新数据的方法
前端·javascript·vue.js