当前位置: 首页 > news >正文

electron 安装报错:RequestError: certificate has expired

在使用 yarn 安装 electron 时,报证书过期的错误。原因是以前使用的阿里的镜像已经过期,改成新的镜像地址就可以了。

报错信息

yarn add electron --dev
yarn add v1.22.5
info No lockfile found.
[1/4] Resolving packages...
⠁ (node:33196) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
warning electron > @electron/get > global-agent > boolean@3.2.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
warning electron > @electron/get > global-agent > roarr > boolean@3.2.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error D:\xx\my-electron-app\node_modules\electron: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: \node_modules\electron
Output:
RequestError: certificate has expired
    at ClientRequest.<anonymous> (node_modules\got\dist\source\core\index.js:970:111)
    at Object.onceWrapper (node:events:633:26)
    at ClientRequest.emit (node:events:530:35)
    at origin.emit (node_modules\@szmarczak\http-timer\dist\source\index.js:43:20)
    at emitErrorEvent (node:_http_client:104:11)
    at TLSSocket.socketErrorListener (node:_http_client:518:5)
    at TLSSocket.emit (node:events:518:28)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
    at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34)
    at TLSSocket.emit (node:events:518:28)
    at TLSSocket._finishInit (node:_tls_wrap:1078:8)
    at ssl.onhandshakedone (node:_tls_wrap:864:12)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

查看配置

yarn config list
yarn config v1.22.5
info yarn config
{
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.yarnpkg.com',
  'strict-ssl': false,
  'user-agent': 'yarn/1.22.5 npm/? node/v22.14.0 win32 x64',
  ELECTRON_MIRROR: 'https://cdn.npm.taobao.org/dist/electron/',
  lastUpdateCheck: 1741746057185
}
info npm config
{}
Done in 0.06s.

修改镜像配置

yarn config set ELECTRON_MIRROR https://registry.npmmirror.com/-/binary/electron/

查看修改后的配置

yarn config list
yarn config v1.22.5
info yarn config
{
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.yarnpkg.com',
  'strict-ssl': false,
  'user-agent': 'yarn/1.22.5 npm/? node/v22.14.0 win32 x64',
  ELECTRON_MIRROR: 'https://registry.npmmirror.com/-/binary/electron/',
  lastUpdateCheck: 1741746057185
}
info npm config
{}
Done in 0.06s.

1

相关链接

https://mjpclab.site/uncategorized/npm-install-electron-by-mirror

相关文章:

  • 第14章 kali linux(网络安全防御实战--蓝军武器库)
  • 「JavaScript深入」理解 Object.defineProperty 与 Proxy
  • 每日一题之能量晶石
  • cursor中git提交记录出现 签出(已分离)
  • 反射、 Class类、JVM的类加载机制、Class的常用方法
  • 每日OJ_牛客_过桥_贪心+BFS_C++_Java
  • 51单片机汇编工程建立、仿真、调试全过程
  • 江科大51单片机笔记【15】直流电机驱动(PWM)
  • 图解AUTOSAR_CP_TcpIp
  • BFS比DFS更好理解「翻转二叉树」
  • 元宇宙与数字孪生
  • 基于Python懂车帝汽车数据分析平台(源码+lw+部署文档+讲解),源码可白嫖!
  • 《HTML + CSS + JS 打造炫酷轮播图详解》
  • 01 | Go 项目开发极速入门课介绍
  • C语言实现冒泡排序,超详解
  • 贝叶斯分层回归(Bayesian Hierarchical Regression)是一种基于贝叶斯统计理论的数据分析方法
  • TDengine SQL 函数
  • 《基于机器学习的DDoS攻击检测与防御系统设计与实现》开题报告
  • postgresql源码安装
  • Jetpack Paging 终极封装:简洁、通用、高性能的分页加载方案
  • 昆明一学校门外小吃摊占满人行道,城管:会在重点时段加强巡查处置
  • 经济日报刊文:品牌经营不能让情怀唱“独角戏”
  • 聆听百年唐调正声:唐文治王蘧常吟诵传习的背后
  • 乌克兰议会批准美乌矿产协议
  • 菲护卫艇企图侵闯中国黄岩岛领海,南部战区:依法依规跟踪监视、警告驱离
  • 李云泽:支持小微企业、民企融资一揽子政策将从增供给、降成本、提效率、优环境4个方面发力