做网站 ecs vps昆明自动seo
在使用 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 expiredat 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.
相关链接
https://mjpclab.site/uncategorized/npm-install-electron-by-mirror