Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

while electron install : Generated checksum for "electron-v2.0.2-win32-x64.zip" did not match expected checksum error. #13168

Closed
KajalJoshi-Clarion opened this issue Jun 6, 2018 · 3 comments

Comments

@KajalJoshi-Clarion
Copy link

Hello ,
I want to install latest electron version in my existing angular application.So I followed npm command to install it.
Command : npm i electron@latest

Expected Behavior
Electron should installed successfully.

Actual Behavior
So, Whenever I tried to install electron, after downloading zip file and SAMSUN.txt file , it is throwing below error....

Error: Generated checksum for "electron-v2.0.2-win32-x64.zip" did not match expected checksum.
at ChecksumMismatchError.ErrorWithFilename (E:\CityLawElectron\node_modules\electron-download\node_modules\sumchecker\build.js:41:124)
at new ChecksumMismatchError (E:\CityLawElectron\node_modules\electron-download\node_modules\sumchecker\build.js:56:133)
at Hash. (E:\CityLawElectron\node_modules\electron-download\node_modules\sumchecker\build.js:203:22)
at emitNone (events.js:106:13)
at Hash.emit (events.js:208:7)
at emitReadable_ (_stream_readable.js:513:10)
at emitReadable (_stream_readable.js:507:7)
at addChunk (_stream_readable.js:274:7)
at readableAddChunk (_stream_readable.js:250:11)
at Hash.Readable.push (_stream_readable.js:208:10)

Please note that I have tried to clear my npm cache using "npm cache clean --force" command and tried to install. but it didn't work.

I also tried to install electron globally using "npm i -g electron@latest", but that approach also didn't work.

Please provide solution as soon as possible because I m really stuck at this problem.

  • Electron Version: 2.0.2
  • Operating System : windows
  • node version : 8.11.2
  • npm version : 6.1.0
  • Last known working Electron version:
@welcome
Copy link

welcome bot commented Jun 6, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@sofianguy
Copy link
Contributor

GitHub issues are for feature requests and bug reports, questions about using Electron or code assistance requests should be directed to the community or to the Slack Channel.

@rickwebiii
Copy link

rickwebiii commented Jun 25, 2018

@KajalJoshi-Clarion

Debugging in the node-inspector, this appears to happen when you get a janky version of sumchecker (1.2.0) on your machine that seems to clash with Node 8. I'm able to repro this with node 8.11.2 on my box when I get sumchecker 1.2.0.

I deleted node_modules\electron\dist (which is the contents of the zip in question) and ran node --inspect-brk node_modules\electron\install.js. Setting a breakpoint in node_modules\sumchecker\build.js inside where it's hashing the file, I see the computed SHA hash is d0695a63356093541553bd373afa548d9473d0e855324781f3ec6ddf91b9cb7e. This is wrong.

Looking in the .electron folder at the .zip Electron downloaded, Powershell reports it's hash to match what's in SHASUMS256.txt:

Get-FileHash .\electron-v2.0.2-win32-x64.zip

Algorithm     Hash                                                                   Path
---------     ----                                                                   ----
SHA256        D19F8782CB836E32A40BA714E57903E8D06BE8D38041B5C4ED59396C8B92204D       

To fix this, you'll need to update your package-lock.json so you download updated versions of the sumchecker package. I'm using yarn and have a yarn.lock file, so I'll leave this an exercise to the reader, but the fix is conceptually the same.

Can you check your npm package-lock.json and check the dependency chain? I repro the bug when electron-download^3.0.1 resolves to 3.0.1, which then causes sumchecker^1.2.0 to resolve to 1.2.0. I edited my lock file so now electron-download^3.0.1 resolves to 3.3.0 and sumchecker ^1.2.0 resolves to 1.3.1, and now this issue doesn't repro. If you then check in your lockfile, everyone else in your org will download non-janky packages, as that's the point of lockfiles.

@sofianguy
This is a bug in Electron, which is easily fixed by bumping electron's electron-downloader package dependency to ^4.0.0, which in turn depends on sumchecker ^2.0.1. Whether or not this will give you more bugs or not I can't say :)

There are a number of other people who've hit this in the past and here's another workaround that uses resolutions in package.json to use the newer downloader if the above doesn't work for you. See
#9595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants