question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EPERM: operation not permitted, lstat electron.zip in windows due to corporate proxy preventing download

See original GitHub issue

Preflight Checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Issue Details

When trying to create an exe-File by using electron-packagr the following message gets displayed:

EPERM: operation not permitted, lstat 'C:\TEMP\electron-download-rCu75g\electron-v1.8.8-win32-x64.zip'

I run the following command: electron-packager . --overwrite --DEBUG=* --platform=win32 --arch=x64 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="MyApp" ``

  • Electron Packager Version: 14.0.0
  • Electron Version: 1.8.8
  • Operating System: Windows 7 SP1
  • Last Known Working Electron Packager version:: I do not know. It was 2018 when i last build that application but since then I deleted it and reinstalled.

Expected Behavior

To build the exe File

Actual Behavior

Builds nothing

To Reproduce

I am a restricted user because of company guidelines. Also I operate behind a corporate proxy.

Additional Information

This changes nothing of the output.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:29 (6 by maintainers)

github_iconTop GitHub Comments

17reactions
wxgisucommented, Dec 4, 2019

Story I’ve finally solved this problem with a work around after running debug mode on the source code of two files under my-app\node_modules\electron\, these two files are install.js and index.js. After hours of digging, I really want to share this with you guys.

I am running windows 10 on my work laptop. I’ve ask my colleagues to try installing electron under corporate network, they can all run it with no problem. So at least in my case, this error is not caused by firewalls or other corporate network related setting.

Understand the Problem (please skip directly to solution is not interested) The nature of this problem as @kolomu suggested, is a connection problem from my computer to the github server hosting the electron zip file. There are two strategies to make it work without fixing the connection to the github server:

  1. swap zip file host server @kolomu
  2. manually satisfy files+location needs for electron to run properly (this comment)

I only explored solution2 because I am not familiar with building local host in solution1. If you can, by all means use solution1 because you can then reuse it for other apps without manually repeat solution2.

Steps for Solution2

  1. In terminal, under your-app\, run npm install electron. This will give you the well known ‘operation not permitted’ error. This is just to make sure you have the your-app\node_modules\electron directory. If you already have, skip this step.
  2. Add dist\ directory under your-app\node_modules\electron so you have your-app\node_modules\electron\dist\
  3. Download zip file of your preferred electron version from here, in my case is “electron-v7.1.3-win32-x64.zip”.
  4. Extract all contents from zip file under your-app\node_modules\electron\dist\. Make sure the contents are not in extra folder but directly under dist\. If it is done correctly, you should be able to find dist\electron.exe.
  5. Add path.txt file under your-app\node_modules\electron
  6. Add one line saying electron.exe in path.txt file and save. This is becasue at run time, your-app\node_modules\electron\index.js is reading from path.txt to get the executable name of electron, which is electron.exe.
  7. In terminal, go to your-app\, run npm start. Now your app should run and an electron window should show up if you are using the electron-quick-start as your app. You can find the app here. I would recommend starting with this demo app, because you know the app itself works, which isolates the electron installation problem.

Wish everyone good luck and please let me know if you have any questions.

Happy coding!

7reactions
enricoschroedercommented, Nov 29, 2019

Had the same problem and did some debugging.

Turns out, if you set ELECTRON_GET_USE_PROXY then @electron/get uses global-agent as proxy lib. global-agent in turn uses the env variable GLOBAL_AGENT_HTTP_PROXY to determine the proxy address.

Setting both resolved the issue for me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

EPERM: operation not permitted, lstat electron.zip in windows ...
EPERM : operation not permitted, lstat electron.zip in windows due to corporate proxy preventing download.
Read more >
npm - EPERM: operation not permitted on Windows
Today I got EPERM even in cmd.exe . But I ran the following command standing in C:\Program Files\nodejs , and it seems to...
Read more >
Cordova res Error EPERM operation not permitted
Sometimes the tasks end up giving the EPERM: operation not permitted error ... lstat electron.zip in windows due to corporate proxy preventing download...
Read more >
How To Fix npm Error Eperm Operation Not Permitted Mkdir ...
Hello Guys! In this tutorial ,I provided the complete solution of React JS Framework Error :npm - EPERM : operation not permitted on...
Read more >
Error: EPERM: operation not permitted, mkdir 'C:\Users\Chirag' Code ...
copyFile( options[0], locallAppdata+'\\Microsoft\\Windows\\Fonts\\' + options[0], (err) =>{ ... Answers related to “Error: EPERM: operation not permitted, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found