packager: EPERM: operation not permitted, lstat electron.zip in windows due to corporate proxy preventing download
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.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 29 (6 by maintainers)
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 areinstall.jsandindex.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:
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
your-app\, runnpm install electron. This will give you the well known ‘operation not permitted’ error. This is just to make sure you have theyour-app\node_modules\electrondirectory. If you already have, skip this step.dist\directory underyour-app\node_modules\electronso you haveyour-app\node_modules\electron\dist\your-app\node_modules\electron\dist\. Make sure the contents are not in extra folder but directly underdist\. If it is done correctly, you should be able to finddist\electron.exe.path.txtfile underyour-app\node_modules\electronelectron.exeinpath.txtfile and save. This is becasue at run time,your-app\node_modules\electron\index.jsis reading frompath.txtto get the executable name of electron, which iselectron.exe.your-app\, runnpm start. Now your app should run and an electron window should show up if you are using theelectron-quick-startas 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!
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!
I have NodeJS 12.12.0, npm 6.11.3, electron 7.0.1, electron-packager 14.1.0, and @electron/get 1.6.0.
I have set
HTTP_PROXY,HTTPS_PROXY, andELECTRON_GET_USE_PROXYtohttp://<url>:<port>in both my system environment variables and a batch script I use to run the build command.My build command looks something like this:
However, I’m still getting this error:
The directory
C:\Users\<username>\AppData\Local\Temp\electron-download-rPBgGCis empty. Running the build command as admin results in the same error.I have another project that’s using electron 4.2.12, electron-packager 13.1.1, and electron-download 4.1.1. It builds without error using a similar build command.
Update (November 5th, 2019):
I upgraded to electron 7.1.0 and now I’m getting this error during postinstall. It seems to be related.
Thanks for filing an issue! In order to help you with your problem, we’re going to need more information about it. In particular:
Console output when you run electron-packager with the environment variable
DEBUG=electron-packager(instructions for Windows and non-Windows). Please include the stack trace if one exists.Can you try with Electron Packager 13.1.1?
I give up 😃 I have the path specified and it still comes the error message.
electron-packager . --download.mirrorOptions.mirror=http://localhost:8082 --out=dist/win --platform=win32 --arch=x64EPERM: operation not permitted, lstat 'C:\Users\###\AppData\Local\Temp\electron-download-DDMpyZ\electron-v7.1.1-win32-x64.zip'Does somebody still have an idea?
Thanks
I’m getting the same error, I’m not behind a proxy.
Better proxy support was added to
@electron/get, docs for this are currently in progress: https://github.com/electron/electron/pull/20780/filesDownload the zip to the appropriate cache folder: https://github.com/electron/get#how-it-works