当我创建一个全新的 create-react-app 并运行命令时,yarn add electron --dev出现以下错误。
RequestError: unable to get local issuer certificate
at ClientRequest.<anonymous> (C:\my-stuff\create-react-test\node_modules\got\source\request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:520:26)
at ClientRequest.emit (events.js:412:35)
at ClientRequest.origin.emit (C:\my-stuff\create-react-test\node_modules\@szmarczak\http-timer\source\index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:475:9)
at TLSSocket.emit (events.js:400:28)
Run Code Online (Sandbox Code Playgroud)
同样的事情发生在 npm 和 Chocolatey 上,并且只发生在 Electron 上。在其他计算机上不会发生这种情况。我已经完全卸载了节点并重新安装了它。
完成下载模块后会发生这种情况。它正在访问ClientRequest我计算机上的某个位置。我不明白为什么。
我已经在互联网上搜索了好几天寻找解决方案。我已经找到了cnpm解决方案并且它确实有效,但我希望我的项目可以使用npm install或从 git 存储库恢复yarn。现在还不是。我必须从我的 中删除电子package.json,恢复,将其添加回来并调用cnpm命令。
npm config set strict-ssl false<- 该命令没有帮助。
我尝试过单独安装got和@szmarczak\http-timer. 这没有帮助。