0

I'm trying to install electron using both npm(npm install electron) and yarn but stuck into a bottleneck issue. PFB the error msg

Error: self signed certificate in certificate chain
    at TLSSocket.onConnectSecure (_tls_wrap.js:1473:34)
    at TLSSocket.emit (events.js:311:20)
    at TLSSocket._finishInit (_tls_wrap.js:916:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:686:12) {
  code: 'SELF_SIGNED_CERT_IN_CHAIN'
}

So, in order to bypass ssl I ran the command npm config set strict-ssl=false and tried again.

Butr now, I get a new error.

ChecksumMismatchError: Generated checksum for 
"electron-v5.0.13-darwin-x64.zip" did not match expected checksum.

PFB the versions I'm using.

Node - v12.16.1

npm - 6.13.4

OS - macOS mojave 10.14.16

Nikhil
  • 665
  • 2
  • 11
  • 25

2 Answers2

1

I struggled with self-signed certificates on an enterprise network too and this is what helps in my case. Whenever I want to install a version of electron, I download the electron-vX.Y.Z-win32-x64.zip and place it in electrons local cache folder. Which is %APP_DATA%\Local\electron\Cache on windows systems.

After that I run a normal npm install. It will look for a cached zip file, find one and use that.

The cache locations for the other operating systems can be found here:

https://www.electronjs.org/docs/tutorial/installation#cache

Edit:

Respondong to your comment - there are a couple of old entries on the electron issue tracker on github, search that for 'ChecksumMismatchError', it hints for mismatching versions of electron, node and maybe other dependencies. One solution would be to calculate the checksum of the zip (assuming, you got it from a trusted source!!) and update the package-lock.json (or yarn). Or - upgrade to the latest version of electron. That's what I recommend, then you get the latest and safest chromium.

https://github.com/electron/electron/issues/13168#issuecomment-400079161

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
0

Found the solution. It was the firewall's issue. Temporarily disabled it to proceed with the installation.

Nikhil
  • 665
  • 2
  • 11
  • 25