Skip to content

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

Closed
@WingDust

Description

@WingDust

image

image

image

image

image

Activity

zhaokjun

zhaokjun commented on Oct 25, 2019

@zhaokjun

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

GitYonglin

GitYonglin commented on Oct 26, 2019

@GitYonglin

It happened to me, too.

leon-o

leon-o commented on Oct 26, 2019

@leon-o

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

zhaokjun commented on Oct 26, 2019

@zhaokjun

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

szhshp commented on Nov 2, 2019

@szhshp

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

UEhQZXI commented on Nov 14, 2019

@UEhQZXI

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

ifreann commented on Nov 27, 2019

@ifreann

@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

binojvr commented on Dec 12, 2019

@binojvr

Why its linux version? is it a typo?

SGissubel

SGissubel commented on Feb 9, 2020

@SGissubel

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

Keith-CY commented on Feb 10, 2020

@Keith-CY

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

appurist commented on Feb 11, 2020

@appurist

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

tkgkn commented on Feb 20, 2020

@tkgkn

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

MGYH commented on Feb 21, 2020

@MGYH

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

surlykke commented on Apr 8, 2020

@surlykke

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.

11 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @surlykke@appurist@JackWCollins@ifreann@Keith-CY

        Issue actions

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