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

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

Closed
3 tasks done
kolomu opened this issue Jun 24, 2019 · 29 comments
Labels
build-host:windows Running Electron Packager on Windows question ❓ Question about using Electron Packager. Not supported in this issue tracker.

Comments

@kolomu
Copy link

kolomu commented Jun 24, 2019

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.

@welcome
Copy link

welcome bot commented Jun 24, 2019

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, 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.

@malept malept added build-host:windows Running Electron Packager on Windows needs info Issue reporter needs to provide more information for maintainers to take action labels Jun 24, 2019
@malept
Copy link
Member

malept commented Jun 24, 2019

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?

@kolomu
Copy link
Author

kolomu commented Jun 25, 2019

Thanks for your help so far.

Here is the console output with debug option on:

D:\dev\projects\myapp_all\myapp-electron>electron-packager . --overwrite --platform=win32 --arch=x64 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"myapp\" > log.txt
  electron-packager Electron Packager 14.0.0
  electron-packager Node v9.4.0
  electron-packager Host Operating system: win32 (x64) +0ms
  electron-packager Packager Options: {"_":["."],"deref-symlinks":true,"derefSymlinks":true,"download":{"rejectUnauthorized":true,"reject-unauthorized":true},"junk":true,"prune":true,"overwrite":true,"platform":"win32","arch":"x64","out":"release-builds","version-string":{"CompanyName":"CE","FileDescription":"CE","ProductName":"myapp"},"versionString":{"companyName":"CE","fileDescription":"CE","productName":"myapp"},"dir":".","protocols":[]} +2ms
  electron-packager Target Platforms: win32 +0ms
  electron-packager Target Architectures: x64 +1ms
  get-package-info Getting props:  [ [ 'productName', 'name' ],
  'version',
  [ 'dependencies.electron',
    'devDependencies.electron',
    'dependencies.electron-nightly',
    'devDependencies.electron-nightly',
    'dependencies.electron-prebuilt-compile',
    'devDependencies.electron-prebuilt-compile',
    'dependencies.electron-prebuilt',
    'devDependencies.electron-prebuilt' ],
  'author' ] +0ms
  get-package-info Looking up starting from directory:  D:\dev\projects\myapp_all\myapp-electron +2ms
  get-package-info Result so far: { values: {}, source: {} } +0ms
  get-package-info Checking props in package.json found at: D:\dev\projects\myapp_all\myapp-electron\package.json +5ms
  get-package-info Found prop: [ 'productName', 'name' ] +0ms
  get-package-info Found prop: version +0ms
  get-package-info Found prop: [ 'dependencies.electron',
  'devDependencies.electron',
  'dependencies.electron-nightly',
  'devDependencies.electron-nightly',
  'dependencies.electron-prebuilt-compile',
  'devDependencies.electron-prebuilt-compile',
  'dependencies.electron-prebuilt',
  'devDependencies.electron-prebuilt' ] +1ms
  get-package-info Couldn't find prop: author +1ms
  get-package-info Not all props satisfied, looking for parent package.json +0ms
  get-package-info Getting props:  [ 'author' ] +1ms
  get-package-info Looking up starting from directory:  D:\dev\projects\myapp_all +0ms
  get-package-info Result so far: { values:
   { productName: 'myapp',
     name: 'myapp',
     version: '1.0.2',
     'dependencies.electron': '^1.8.8',
     'devDependencies.electron': '^1.8.8',
     'dependencies.electron-nightly': '^1.8.8',
     'devDependencies.electron-nightly': '^1.8.8',
     'dependencies.electron-prebuilt-compile': '^1.8.8',
     'devDependencies.electron-prebuilt-compile': '^1.8.8',
     'dependencies.electron-prebuilt': '^1.8.8',
     'devDependencies.electron-prebuilt': '^1.8.8' },
  source:
   { productName:
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'name' },
     name:
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'name' },
     version:
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'version' },
     'dependencies.electron':
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'devDependencies.electron' },
     'devDependencies.electron':
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'devDependencies.electron' },
     'dependencies.electron-nightly':
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'devDependencies.electron' },
     'devDependencies.electron-nightly':
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'devDependencies.electron' },
     'dependencies.electron-prebuilt-compile':
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'devDependencies.electron' },
     'devDependencies.electron-prebuilt-compile':
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'devDependencies.electron' },
     'dependencies.electron-prebuilt':
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'devDependencies.electron' },
     'devDependencies.electron-prebuilt':
      { src: 'D:\\dev\\projects\\myapp_all\\myapp-electron\\package.json',
        pkg: [Object],
        prop: 'devDependencies.electron' } } } +0ms
  get-package-info Couldn't find any more package.json files +3ms
  electron-packager Inferring application name from name in D:\dev\projects\myapp_all\myapp-electron\package.json +0ms
  electron-packager Inferring appVersion from version in D:\dev\projects\myapp_all\myapp-electron\package.json +0ms
  electron-packager Inferring target Electron version from electron in D:\dev\projects\myapp_all\myapp-electron\package.json +3ms
  electron-packager Application name: myapp +17ms
  electron-packager Target Electron version: 1.8.8 +0ms
  electron-packager Ignored path regular expressions: [ '/\\.git($|/)', '/node_modules/\\.bin($|/)', '\\.o(bj)?$' ] +0ms
  electron-packager Downloading Electron with options {"rejectUnauthorized":true,"reject-unauthorized":true,"platform":"win32","arch":"x64","version":"1.8.8","artifactName":"electron"} +0ms
  @electron/get:index Checking the cache for electron-v1.8.8-win32-x64.zip +0ms
  @electron/get:index Cache miss +1ms
  @electron/get:index Downloading https://github.com/electron/electron/releases/download/v1.8.8/electron-v1.8.8-win32-x64.zip to C:\TEMP\electron-download-SU0IRn\electron-v1.8.8-win32-x64.zip with options: undefined +37ms

I think the problem is in downloading electron. Because the corporate proxy won't allow that so easily.
Most of the time I can manually download the file and point the application to it.
Is this here possible too?

With the debug log I thought of downloading the file and putting it in there. However the directory name in temp changes everytime I start the build process.

@no-response no-response bot removed the needs info Issue reporter needs to provide more information for maintainers to take action label Jun 25, 2019
@malept malept changed the title EPERM: operation not permitted, lstat electron.zip in windows EPERM: operation not permitted, lstat electron.zip in windows due to corporate proxy preventing download Jun 25, 2019
@malept
Copy link
Member

malept commented Jun 25, 2019

Download the zip to the appropriate cache folder: https://github.com/electron/get#how-it-works

@malept malept closed this as completed Jun 25, 2019
@malept malept added question ❓ Question about using Electron Packager. Not supported in this issue tracker. and removed bug 🐛 labels Jun 25, 2019
@beelo
Copy link

beelo commented Aug 21, 2019

Was this resolved? how do i determine which is the appropriate cache folder?

@malept
Copy link
Member

malept commented Aug 21, 2019

Click the link and choose the operating system you're running Electron Packager on (not the target).

@kdonah3
Copy link

kdonah3 commented Aug 28, 2019

EDIT: could the problem be due to not having correct privileges to create symbolic links? I'm certain most group policies would have that disabled outside of true admins. Not sure what a workaround for that would be if that is true

I'm having the same exact issue. The zip is in the appropriate cache.

I can see the temp electron download folder created, the image of the zip file appears with file size 0kb, then a few seconds later we get the lstat error message.

I tried from my personal machine and it works fine, but it does not work on my company laptop. I can install packages just fine, but for some reason the packager can't get past this part.

@kaushikchaubal
Copy link

I am facing a similar issue as @kolomu . Here is what I get when i run it on the mac (behind corporate proxy):

$ electron-packager . my-app-mac --overwrite --platform=darwin --arch=x64  --prune=true --out=packaged
  electron-packager Electron Packager 14.0.5
  electron-packager Node v10.15.3
  electron-packager Host Operating system: darwin 18.5.0 (x64) +0ms
  electron-packager Packager Options: {"_":[".","my-app-mac"],"deref-symlinks":true,"derefSymlinks":true,"download":{"rejectUnauthorized":true,"reject-unauthorized":true},"junk":true,"prune":true,"overwrite":true,"platform":"darwin","arch":"x64","out":"packaged","dir":".","name":"my-app-mac","protocols":[]} +1ms
  electron-packager Target Platforms: darwin +1ms
  electron-packager Target Architectures: x64 +0ms
  electron-packager Inferring appVersion from version in /Users/kachauba/Documents/code/my-app/package.json +0ms
  electron-packager Inferring target Electron version from electron in /Users/kachauba/Documents/code/my-app/package.json +4ms
  electron-packager Application name: my-app-mac +12ms
  electron-packager Target Electron version: 6.0.2 +0ms
  electron-packager Ignored path regular expressions: [ '/\\.git($|/)', '/node_modules/\\.bin($|/)', '\\.o(bj)?$' ] +0ms
  electron-packager Downloading Electron with options {"rejectUnauthorized":true,"reject-unauthorized":true,"platform":"darwin","arch":"x64","version":"6.0.2","artifactName":"electron"} +0ms
connect ETIMEDOUT 192.30.253.113:443

I did some digging and this is what I understand:

  1. Looks like it is reaching this line in electron-packager: https://github.com/electron/electron-packager/blob/master/src/download.js#L35
  2. downloadArtifact is a function from @electron/get and under the hood, i feel it is getting stuck here: https://github.com/electron/get/blob/master/src/GotDownloader.ts#L15
  3. got.stream is a function from sindresorhus/got package but i have no idea how to make it proxy aware

What all have I tried unsuccessfully?

  1. Downloading the electron zip (as recommended by @malept).However, that does not work as electron-packager creates a random directory-name and so, i don't know what should be the exact directory name where I download and extract the zip file in
  2. Setting HTTP and HTTPS proxy in the global .npmrc
  3. Setting HTTP and HTTPS proxy in the project .npmrc
  4. Setting these environment variables: HTTP_PROXY, HTTPS_PROXY, GLOBAL_AGENT_HTTP_PROXY, GLOBAL_AGENT_HTTPS_PROXY (as suggested here: https://github.com/sindresorhus/got#proxies)

@malept / others - any other recommendations?

@malept
Copy link
Member

malept commented Sep 3, 2019

Downloading the electron zip (as recommended by @malept).However, that does not work as electron-packager creates a random directory-name and so, i don't know what should be the exact directory name where I download and extract the zip file in

There was a recent change to @electron/get (electron/get#113) where zip files get put in a subfolder of the standard cache dir, named for the URL that is the source. Electron Packager does not create a random directory name for the cache.

any other recommendations?

As a last resort, you may have to write your own CLI wrapper around the electron-packager module, and pass the relevant proxy code from https://github.com/sindresorhus/got#proxies to download.downloadOptions.

@kdonah3
Copy link

kdonah3 commented Sep 3, 2019

I am facing a similar issue as @kolomu . Here is what I get when i run it on the mac (behind corporate proxy):

$ electron-packager . my-app-mac --overwrite --platform=darwin --arch=x64  --prune=true --out=packaged
  electron-packager Electron Packager 14.0.5
  electron-packager Node v10.15.3
  electron-packager Host Operating system: darwin 18.5.0 (x64) +0ms
  electron-packager Packager Options: {"_":[".","my-app-mac"],"deref-symlinks":true,"derefSymlinks":true,"download":{"rejectUnauthorized":true,"reject-unauthorized":true},"junk":true,"prune":true,"overwrite":true,"platform":"darwin","arch":"x64","out":"packaged","dir":".","name":"my-app-mac","protocols":[]} +1ms
  electron-packager Target Platforms: darwin +1ms
  electron-packager Target Architectures: x64 +0ms
  electron-packager Inferring appVersion from version in /Users/kachauba/Documents/code/my-app/package.json +0ms
  electron-packager Inferring target Electron version from electron in /Users/kachauba/Documents/code/my-app/package.json +4ms
  electron-packager Application name: my-app-mac +12ms
  electron-packager Target Electron version: 6.0.2 +0ms
  electron-packager Ignored path regular expressions: [ '/\\.git($|/)', '/node_modules/\\.bin($|/)', '\\.o(bj)?$' ] +0ms
  electron-packager Downloading Electron with options {"rejectUnauthorized":true,"reject-unauthorized":true,"platform":"darwin","arch":"x64","version":"6.0.2","artifactName":"electron"} +0ms
connect ETIMEDOUT 192.30.253.113:443

I did some digging and this is what I understand:

  1. Looks like it is reaching this line in electron-packager: https://github.com/electron/electron-packager/blob/master/src/download.js#L35
  2. downloadArtifact is a function from @electron/get and under the hood, i feel it is getting stuck here: https://github.com/electron/get/blob/master/src/GotDownloader.ts#L15
  3. got.stream is a function from sindresorhus/got package but i have no idea how to make it proxy aware

What all have I tried unsuccessfully?

  1. Downloading the electron zip (as recommended by @malept).However, that does not work as electron-packager creates a random directory-name and so, i don't know what should be the exact directory name where I download and extract the zip file in
  2. Setting HTTP and HTTPS proxy in the global .npmrc
  3. Setting HTTP and HTTPS proxy in the project .npmrc
  4. Setting these environment variables: HTTP_PROXY, HTTPS_PROXY, GLOBAL_AGENT_HTTP_PROXY, GLOBAL_AGENT_HTTPS_PROXY (as suggested here: https://github.com/sindresorhus/got#proxies)

@malept / others - any other recommendations?

I was able to get it to work by using electron-packager-interactive. it must use a different mechanism, but I didn't have time to dig further into it. see if it could work for you?

@a4chet
Copy link

a4chet commented Sep 6, 2019

--download.cacheRoot seems to be ignored at least in @electron/get@1.5.0

My electron-packager always tries to go download electron on my offline machine with this dependency version. This worked fine in @electron/get@1.3.1.

@malept
Copy link
Member

malept commented Sep 6, 2019

@a4chet if cacheRoot is not working for you, please file a bug at the @electron/get issue tracker. That is unrelated to this bug.

@kolomu
Copy link
Author

kolomu commented Oct 17, 2019

Hi, if still someone struggles with this problem here is my current workaround :

  1. determine what file electron-packager is downloading: in Powershell:
    $env:DEBUG='electron-packager';electron-packager .
  2. Download the required file manually (select the right version (zip) + SHASUMS256.txt)
  3. Install http-server to serve the file manually
    npm i -g http-server
  4. create a version folder e.g. v1.8.8 and copy the downloaded zip file + checksum.txt file in it
  5. switch to that directory and start server with http-server
  6. finally build the electron-app by providing the following mirror:
    electron-packager . --download.mirrorOptions.mirror=http://localhost:8080

Now it should build.

@booltv
Copy link

booltv commented Oct 19, 2019

Hi, if still someone struggles with this problem here is my current workaround :

  1. determine what file electron-packager is downloading: in Powershell:
    $env:DEBUG='electron-packager';electron-packager .
  2. Download the required file manually (select the right version (zip) + SHASUMS256.txt)
  3. Install http-server to serve the file manually
    npm i -g http-server
  4. create a version folder e.g. v1.8.8 and copy the downloaded zip file + checksum.txt file in it
  5. switch to that directory and start server with http-server
  6. finally build the electron-app by providing the following mirror:
    electron-packager . --download.mirrorOptions.mirror=http://localhost:8080

Now it should build.

I do what you said above, but it still failed.it reported "EPERM: operation not permitted, lstat 'C:\Users\y\AppData\Local\Temp\electron-download-nprkeq\electron-v6.0.12-win32-x64.zip'"

@kolomu
Copy link
Author

kolomu commented Oct 19, 2019

It seems like it still tries to download the file remotely. Did you start the http server with the zip file and provided the download.mirrorOptions.mirror which is pointing to localhost? What electron-packager version are you using? I installed the latested version with npm i -g electron-packager

@booltv
Copy link

booltv commented Oct 21, 2019

It seems like it still tries to download the file remotely. Did you start the http server with the zip file and provided the download.mirrorOptions.mirror which is pointing to localhost? What electron-packager version are you using? I installed the latested version with npm i -g electron-packager

I did it again and it worked success!! Thank you so much!love you

@malept
Copy link
Member

malept commented Oct 28, 2019

Better proxy support was added to @electron/get, docs for this are currently in progress: https://github.com/electron/electron/pull/20780/files

@CivBase
Copy link

CivBase commented Nov 1, 2019

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, and ELECTRON_GET_USE_PROXY to http://<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:

electron-packager . <name> --out dist --overwrite --platform win32 --arch x64

However, I'm still getting this error:

EPERM: operation not permitted, lstat 'C:\Users\<username>\AppData\Local\Temp\electron-download-rPBgGC\electron-v7.0.1-win32-x64.zip'

The directory C:\Users\<username>\AppData\Local\Temp\electron-download-rPBgGC is 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.

(node:20640) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, lstat 'C:\Users\<username>\AppData\Local\Temp\electron-download-pTQppp\electron-v7.1.0-win32-ia32.zip'
(node:20640) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20640) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@NaridaL
Copy link

NaridaL commented Nov 2, 2019

I'm getting the same error, I'm not behind a proxy.

@Reiser89
Copy link

Reiser89 commented Nov 5, 2019

Had the same error on my company laptop. I could fix it by disconnecting from the company network and using my private mobile hotspot.

@itaymty
Copy link

itaymty commented Nov 10, 2019

Hi, if still someone struggles with this problem here is my current workaround :

  1. determine what file electron-packager is downloading: in Powershell:
    $env:DEBUG='electron-packager';electron-packager .
  2. Download the required file manually (select the right version (zip) + SHASUMS256.txt)
  3. Install http-server to serve the file manually
    npm i -g http-server
  4. create a version folder e.g. v1.8.8 and copy the downloaded zip file + checksum.txt file in it
  5. switch to that directory and start server with http-server
  6. finally build the electron-app by providing the following mirror:
    electron-packager . --download.mirrorOptions.mirror=http://localhost:8080

Now it should build.

Tried what you suggested and I still get "EPERM: operation not permitted, lstat 'C:\Users\y\AppData\Local\Temp\electron-download-nprkeq\electron-v6.0.12-win32-x64.zip'"

this is my build command :
electron-packager . --download.mirrorOptions.mirror=http://localhost:8080/electron-v6.0.12-win32-x64.zip --out=dist/win --platform=win32 --arch=x64

do you have any suggestions on what the problem might be?

@kolomu
Copy link
Author

kolomu commented Nov 10, 2019

yep the mirror should not include the full url but just the hostname

@itaymty
Copy link

itaymty commented Nov 11, 2019

yep the mirror should not include the full url but just the hostname
tried it both ways without any luck

@cytrics
Copy link

cytrics commented Nov 19, 2019

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=x64

EPERM: 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

@avin-shum
Copy link

I have the same problem, but I can access github to download the package through. So I think it is not due to proxy setting (I have set ELECTRON_GET_USE_PROXY already). But I still have the same problem.

I tried also using the local web server approach but without luck.

@enricoschroeder
Copy link

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!

@wxgisu
Copy link

wxgisu commented 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!

@JessicaIpo
Copy link

For me, specify electron version in command line
( warning! when you launch cmd "electron .", it is possible that he system use path variable "/appData/Roaming/npm/" cause of that, the system used a different version of electron than the version in your current project)

Example :
electron-packager . electron-app-asar --electron-version 7.1.4 --platform=win32 --arch=ia32 --asar --overwrite --app-copyright="Copyright (c) 2019 The Client. All rights reserved.""

@doncicuto
Copy link

In my case I've downloaded an electron zip file from https://github.com/electron/electron/releases/ and stored it in my computer.

electron-packager has a command-line option called electron-zip-dir that you can use to specify the directory where you've placed your electron zip file.

Example:
electron-packager . electron-app-asar --electron-version 8.3.0 --platform=win32 --arch=x64 --electron-zip-dir=C::\Temp --overwrite

That way electron-packager won't try to download it using your proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-host:windows Running Electron Packager on Windows question ❓ Question about using Electron Packager. Not supported in this issue tracker.
Projects
None yet
Development

No branches or pull requests