electron: electron install failed:unable to verify the first certificate
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
I have checked Electron download failed #21353, but I think it’s not the same problem with this one.
Issue Details
- Electron Version:
- Operating System: windows
- Last Known Working Electron version:
Expected Behavior
- ** I run
yarn add electronto install electron but exited with the following errors:**
yarn add v1.22.5
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > @vue/composition-api@1.0.0-beta.21" has unmet peer dependency "vue@>= 2.5 < 3".
warning " > element-ui@2.14.1" has unmet peer dependency "vue@^2.5.17".
warning " > ts-loader@8.0.11" has unmet peer dependency "webpack@*".
[5/5] Building fresh packages...
[5/5] ⡀ electron
[2/5] ⡀ core-js
[-/5] ⢀ waiting...
[-/5] ⢀ waiting...
error D:\Learn\web\quasar\node_modules\electron: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: D:\Learn\web\quasar\node_modules\electron
Output:
RequestError: unable to verify the first certificate
at ClientRequest.<anonymous> (D:\Learn\web\quasar\node_modules\got\source\request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:418:26)
at ClientRequest.emit (events.js:323:22)
at ClientRequest.origin.emit (D:\Learn\web\quasar\node_modules\@szmarczak\http-timer\source\index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:311:20)
-
Then I set strict-ssl to false of both npm and yarn, and tried
yarn add electronagain, don’t work. -
Then I look into node_modules/electron/install.js and added some
console.log('--',xx), and run node .\install.js, got some output:
--remote url: https://github.com/electron/electron/releases/download/v11.0.4/electron-v11.0.4-win32-x64.zip
--cache: Cache {
cacheRoot: 'C:\\Users\\Administrator\\AppData\\Local\\electron\\Cache'
}
--downloadArtifact err GotError [RequestError]: unable to verify the first certificate
at ClientRequest.<anonymous> (D:\Learn\web\quasar\node_modules\got\source\request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:418:26)
at ClientRequest.emit (events.js:323:22)
at ClientRequest.origin.emit (D:\Learn\web\quasar\node_modules\@szmarczak\http-timer\source\index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:311: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) {
name: 'RequestError',
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
host: 'github.com',
hostname: 'github.com',
method: 'GET',
path: '/electron/electron/releases/download/v11.0.4/electron-v11.0.4-win32-x64.zip',
socketPath: undefined,
protocol: 'https:',
url: 'https://github.com/electron/electron/releases/download/v11.0.4/electron-v11.0.4-win32-x64.zip',
gotOptions: {
path: '/electron/electron/releases/download/v11.0.4/electron-v11.0.4-win32-x64.zip',
protocol: 'https:',
slashes: true,
auth: null,
host: 'github.com',
port: null,
hostname: 'github.com',
hash: null,
search: null,
query: null,
pathname: '/electron/electron/releases/download/v11.0.4/electron-v11.0.4-win32-x64.zip',
href: 'https://github.com/electron/electron/releases/download/v11.0.4/electron-v11.0.4-win32-x64.zip',
retry: {
retries: [Function],
methods: [Set],
statusCodes: [Set],
errorCodes: [Set]
},
headers: {
'user-agent': 'got/9.6.0 (https://github.com/sindresorhus/got)',
'accept-encoding': 'gzip, deflate'
},
hooks: {
beforeRedirect: [],
afterResponse: [],
throwHttpErrors: true,
followRedirect: true,
stream: true,
json: false,
cache: false,
useElectronNet: false,
method: 'GET'
}
}
--downloadArtifact err.stack RequestError: unable to verify the first certificate
at ClientRequest.<anonymous> (D:\Learn\web\quasar\node_modules\got\source\request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:418:26)
at ClientRequest.emit (events.js:323:22)
at ClientRequest.origin.emit (D:\Learn\web\quasar\node_modules\@szmarczak\http-timer\source\index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:311: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)
-
** I checked the cache folder ‘C:\Users\Administrator\AppData\Local\electron\Cache’ and found the target version has already cached (why don’t it just use the cached zip file?). **
-
**Note that I have set ELECTRON_MIRROR to https://npm.taobao.org/mirrors/electron/ of both npm and yarn. **
-
Then I deleted ELECTRON_MIRROR config item of both npm and yarn, still don’t work.
-
Note: expect for electron, other packages can be installed normally.
-
I use npm to install electron, it also failed with this errors:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@11.0.4 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@11.0.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any help is appreciated!!!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18
The error is occurred when electron download zip.
There has two workarounds:
Manually download electron.zip (for example: 10.3.0)
download zip from https://github.com/electron/electron/releases/download/v10.3.0/electron-v10.3.0-win32-x64.zip
unzip to
node_modules/electron/dist/add a file which named
path.txttonode_modules/electron/path.txtAdd environment variable (work for me but not very clearly)
set ELECTRON_MIRROR=http://npm.taobao.org/mirrors/electron/to change environment variables temporarilycnpm installto install electron (yarndidn’t work either)Then the download base url will change to
http://npm.taobao.org/mirrors/electron/, see https://github.com/electron/get/blob/8aaa411787d32fd58b5f02c34499cfa927b93b59/src/artifact-utils.ts#L39system:windows 10 electron:17.2.0 1、set ELECTRON_MIRROR=http://npm.taobao.org/mirrors/electron/ in environment variables 2、execute: yarn install it work for me
Run this to install dependencies:
The only way I found could resolve this problem.
Reference: https://blog.csdn.net/junbujianwpl/article/details/119820974
This issue is still exist now
This issue is still exist now
I also encountered this problem, checked for two days
This issue is still exist now…
So,why closing this issue without any other explain