初次学习electron发现安装都安装不了?

系统环境:
WIN10 2004,
node v12.18.3
npm 6.14.6
按照官网教程执行到npm install --save-dev electron这一步的时候提示我

npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://registry.npmjs.org/electron failed, reason: self signed certificate in certificate chain

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\crack\AppData\Roaming\npm-cache\_logs\2020-09-25T15_04_16_999Z-debug.log

通过百度说要禁用SSL?
然后我执行了npm set strict-ssl false
当我再次执行npm install --save-dev electron这个命令却收到提示:


> electron@10.1.2 postinstall D:\mysqlapp\node_modules\electron
> node install.js

RequestError: self signed certificate in certificate chain
    at ClientRequest.<anonymous> (D:\mysqlapp\node_modules\got\source\request-as-event-emitter.js:178:14)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:327:22)
    at ClientRequest.origin.emit (D:\mysqlapp\node_modules\@szmarczak\http-timer\source\index.js:37:11)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
npm WARN mysqlapp@1.0.0 No description
npm WARN mysqlapp@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@10.1.2 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@10.1.2 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:\Users\crack\AppData\Roaming\npm-cache\_logs\2020-09-25T15_09_58_844Z-debug.log

还是SSL的问题,请问这个该怎么解决???

阅读 323
评论
    3 个回答

    好吧,我发现了,杀软的问题解决了...

      我之前在安装electron的时候遇到过类似的,我使用npmyarn都安装不上(换源之后也不可以),最后使用cnpm安装成功的,你可以试一下cnpm,安装成功了可以执行npx electron -v看一下版本,你可以参考这里

        # .npmrc file in the project root directory.
        ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/

        该答案已被忽略,原因:不符合答题规范 - 内容不是答案,可用评论、投票替代

          撰写回答

          登录后参与交流、获取后续更新提醒

          相似问题
          推荐文章