Skip to content

electron always "Electron failed to install correctly, please delete node_modules/electron and try installing again" #20731

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

Closed
WingDust opened this issue Oct 25, 2019 · 17 comments
Labels

Comments

@WingDust
Copy link

WingDust commented Oct 25, 2019

image

image

image

image

image

@zhaokjun
Copy link

I have the same problem,but electron 6 works well in my computer

@GitYonglin
Copy link

It happened to me, too.

@leon-o
Copy link

leon-o commented Oct 26, 2019

The path.txt is missing.
Try to run node node_modules/electron/install.js. It should be run automaticlly after you installed electron.

I have the same problem and I run the install.js many times. It seems that function 'downloadArtifact' took so much time that it failed to create path.txt.

https://github.com/electron/electron/blob/master/npm/install.js#L31

@zhaokjun
Copy link

The path.txt is missing.
Try to run node node_modules/electron/install.js. It should be run automaticlly after you installed electron.

I have the same problem and I run the install.js many times. It seems that function 'downloadArtifact' took so much time that it failed to create path.txt.

https://github.com/electron/electron/blob/master/npm/install.js#L31

Yes,It causes this problem,but I failed to download electron-v7.0.0-win32-x64.zip through install.js. Eventually, I download electron-v7.0.0-win32-x64.zip from https://npm.taobao.org/mirrors/electron/7.0.0/ ,and unzip it into node_modules\electron\, then create path.txt file with text electron.exe in that directory.Finally,I launched electron@7.0.0. It is the network that causes the problem(electron6 has a different function to download,and it might could download from a mirror).I also find the incomplete cache file in my computer。Is it possible to set a mirror ?

@szhshp
Copy link

szhshp commented Nov 2, 2019

The path.txt is missing.
Try to run node node_modules/electron/install.js. It should be run automaticlly after you installed electron.
I have the same problem and I run the install.js many times. It seems that function 'downloadArtifact' took so much time that it failed to create path.txt.
https://github.com/electron/electron/blob/master/npm/install.js#L31

Yes,It causes this problem,but I failed to download electron-v7.0.0-win32-x64.zip through install.js. Eventually, I download electron-v7.0.0-win32-x64.zip from https://npm.taobao.org/mirrors/electron/7.0.0/ ,and unzip it into node_modules\electron\, then create path.txt file with text electron.exe in that directory.Finally,I launched electron@7.0.0. It is the network that causes the problem(electron6 has a different function to download,and it might could download from a mirror).I also find the incomplete cache file in my computer。Is it possible to set a mirror ?

Got totally same error.....

@UEhQZXI
Copy link

UEhQZXI commented Nov 14, 2019

i made it!

  1. npm install electron -g
  2. get error EPERM: operation not permitted, lstat 'C:\Users\XXXX\AppData\Local\Temp\electron-download-eQhWL8\electron-v7.1.1-win32-x64.zip
  3. download the package from this link https://github.com/electron/electron/releases/download/v7.1.1/electron-v7.1.1-linux-x64.zip
  4. move to C:\Users\XXXX\AppData\Roaming\npm\node_modules\electron
  5. edit install.js, comment downloadArtifact and add extractFile('./electron-v7.1.1-win32-x64.zip');
    微信图片_20191114171001
  6. node install.js
  7. run electron in the terminal

@ifreann
Copy link

ifreann commented Nov 27, 2019

@lutianxiong thank you, that actually worked. To clarify for anyone else following your instructions, add a step "3.5" where you add the downloaded Electron .zip to C:\Users\XXXX\AppData\Roaming\npm\node_modules\electron

@binojvr
Copy link

binojvr commented Dec 12, 2019

Why its linux version? is it a typo?

@SGissubel
Copy link

SGissubel commented Feb 9, 2020

Is an actual fix for this in the pipeline? It would be nice for the actual issue to be resolved - instead of just work-arounds. I just tried to install Electron this morning, and I got the same error when trying to run Electron

@Keith-CY
Copy link

Actually the install.js didn't run as expected, then I manually add the dist file from https://npm.taobao.org/mirrors/electron/7.1.11/ into the node_modules/electron/dist and change launch method getElectronPath in the node_modules/electron/index.js to return the ./dist/Electron.app/Contents/MacOS/Electron.

@appurist
Copy link

appurist commented Feb 11, 2020

I have this problem with the 8.0.0 release, after upgrading electron from 6.1. I am running on a Windows 10 machine and have tried both npm and yarn. The path.txt file is not present in the electron folder, and there is no dist subfolder. So there is a problem with the npm install of electron.

I have two government projects in strict automated environments where packages referenced just need to work. The approach of issuing commands, manually copying files around from older versions etc just isn't a practical solution of any kind for me.

Is the only official supported workaround for this problem to revert to an older 7.x version? Or is there an 8.0.1 update coming that addresses this, and if so, what is the timeline on that?

@tkgkn
Copy link

tkgkn commented Feb 20, 2020

I download the zip from the taobao mirror, and move the zip to node_modules/electron, then modify the logic that exec the zip instead of download the zip, it's ok, but some minitues later, the error is happend again. And I check the node_modules/electron/install.js, what I modified logic is disappeard. 😢 It's version is 8.0.0.

@MGYH
Copy link

MGYH commented Feb 21, 2020

I download the zip from the taobao mirror, and move the zip to node_modules/electron, then modify the logic that exec the zip instead of download the zip, it's ok, but some minitues later, the error is happend again. And I check the node_modules/electron/install.js, what I modified logic is disappeard. 😢 It's version is 8.0.0.
I solved it. I used yarn, and I find this file in the "C:\Users\local\AppData\Local\Yarn\Data\global\node_modules\electron".

  1. If your network is slow yarn global add install --verbose electron, The terminal will display the download progress. But I download failed “HTTPError: Response code 404 (Not Found) for https://npm.taobao.org/mirrors/electron/v8.0.1/electron-v8.0.1-win32-x64.zip"
  2. I found it on 'https://github.com/electron/electron/releases/v8.0.1/',you can change the version
    "https://github.com/electron/electron/releases/v8.0.0/"
  3. According to @lutianxiong, move to C:\Users\local\AppData\Local\Yarn\Data\global\node_modules\electron
    edit install.js, comment downloadArtifact and add extractFile('./electron-v7.1.1-win32-x64.zip');
    微信图片_20191114171001
    4.node install.js
    5.run electron in the terminal
    6.If you install electron in your project before you finish the above, you can use 3,4,5 to solve it, of reinstall.

My english is poor, hope i can help you

@surlykke
Copy link

surlykke commented Apr 8, 2020

This is probably not relevant for anyone on this thread, but just in case:

I was getting 'Electron failed to install correctly, please...', and tried downgrading/upgrading electron, removing node_modules, removing ~/.cache/electron, running electron-fix, ... nothing worked.

Turned out the issue was that I had

target: "node"

in webpack.config.js. Changing that to

target: "electron-renderer"

fixed it.

Not the most enlightning error message I've come across.

@JackWCollins
Copy link

I was on node v12.13.0 and seeing this error. I upgraded node to version 13.8.0 and that fixed the error for me. I hope this can help someone else!

@AxelRothe
Copy link

This is probably not relevant for anyone on this thread, but just in case:

I was getting 'Electron failed to install correctly, please...', and tried downgrading/upgrading electron, removing node_modules, removing ~/.cache/electron, running electron-fix, ... nothing worked.

Turned out the issue was that I had

target: "node"

in webpack.config.js. Changing that to

target: "electron-renderer"

fixed it.

Not the most enlightning error message I've come across.

This worked for me! Thanks!

@electron-triage
Copy link

The Electron version reported on this issue is no longer supported. See our supported versions documentation.

If this is still reproducible on a supported version, please open a new issue with any other new information that a maintainer should know.

Thank you for taking the time to report this issue and helping to make Electron better! Your help is appreciated.

taratatach added a commit to cozy-labs/cozy-desktop that referenced this issue Jul 28, 2022
  Electron installation can fail silently  triggering errors later when trying
  to make use of it.
  As suggested in a comment (see electron/electron#20731 (comment)),
  manually launching the installation seems to do the trick.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests