electron: Cannot install behind corporate firewall
Windows 7:
C:\electron\project\node_modules\electron\install.js:47
throw err
^
Error: unable to get local issuer certificate
at TLSSocket.<anonymous> (_tls_wrap.js:1088:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:188:7)
at TLSSocket._finishInit (_tls_wrap.js:610:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 31 (4 by maintainers)
export NODE_TLS_REJECT_UNAUTHORIZED=0 Worked for me
Have you tried with
npm config set strict-ssl false? Im also using a corporate proxy and that worked for me.We recommend you utilize external tools available to you to properly configure your proxy, or do something like
npm config set strict-ssl false. At present, this isn’t something for which the optimal solution presents itself as a change to Electron itself.@codebytere - thank you, we have moved away from trying Electron and went with nwjs. It is just not possible to use Electron in our environment.
To specifically address your suggestions: 1) I can’t change the proxy configuration. It is configured correctly as required by corporate policy. 2) npm works just fine because I have the strict-ssl setting. The issue is the Electron post install script and it cannot be addressed by npm.
Why closed? this issue hasn’t been resolved. I am still getting same issue.
Also for me it’s not fixed. trying to download electron 9.0.2 specified an cafile and set the strict-ssl option to false. always getting the electron post install error
> node install.js RequestError: unable to get local issuer certificate at ClientRequest. (C:\Users\userName\Downloads\projectName\packager-test\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 (C:\Users\userName\Downloads\projectName\packager-test\node_modules\@szmarczak\http-timer\source\index.js:37:11) at TLSSocket.socketErrorListener (_http_client.js:432:9) at TLSSocket.emit (events.js:315:20) at emitErrorNT (internal/streams/destroy.js:84:8) at processTicksAndRejections (internal/process/task_queues.js:84:21)EDIT: SOLVED by:
set NODE_EXTRA_CA_CERTS=/path/to/issuer/.crtspecify the node_extra_ca_certs for nodejs before downloading electron solved the problem.
Similar issue here. We have an npm cache using aritfactory - that is: We usually do not use the official npm registry but our local one. We have to do this because our corporate proxy needs authentication.
Of course this won’t work as long as the post-install script tries to download something itself.
Hard coding the proxy credentials in the configuration file for my local PC is bad. Doing this in our CI system is impossible. I currently see two options:
PS.: We’re currently working on Windows7
EDIT: Simply setting
$env:NODE_TLS_REJECT_UNAUTHORIZED=0before the electron install ended up working. Then even after setting it back to 1, everything works as normal. But I will leave my original workaround below in case it still helps someone.Can you try
Not all of them might be required.
ref https://www.electronjs.org/docs/tutorial/installation#proxies
(replace
http://localhost:8888with your own proxy)Works.