NPM安装电子错误-无法验证第一个证书



我已经创建了一个app目录。

npm init

安装电子时使用下面的行

npm install electron --save-dev

低于错误

> core-js@3.9.0 postinstall C:UsersBLUEJavaScriptwelcome_appnode_modulescore-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> electron@11.3.0 postinstall C:UsersBLUEJavaScriptwelcome_appnode_moduleselectron
> node install.js
RequestError: unable to verify the first certificate
at ClientRequest.<anonymous> (C:UsersBLUEJavaScriptwelcome_appnode_modulesgotsourcerequest-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:327:22)
at ClientRequest.origin.emit (C:UsersBLUEJavaScriptwelcome_appnode_modules@szmarczakhttp-timersourceindex.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:469:9)
at TLSSocket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
npm WARN welcome_app@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@11.3.0 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@11.3.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersBLUEAppDataRoamingnpm-cache_logs2021-02-24T23_44_06_772Z-debug.log

我已经尝试了这个设置ssl限制为false之后,仍然不工作

这个问题可能是由错误的电子注册表引起的,删除node_modules文件夹并尝试下面的代码来设置您的注册表,也许它可以解决您的问题

yarn config set ELECTRON_MIRROR http://registry.yarnpkg.com/mirrors/electron/

我已经通过代码修复了这个问题,我认为"https"在这里不起作用,你应该使用"http"而不是"https",

相关内容

  • 没有找到相关文章

最新更新