electron / electron-quick-start

Clone to try a simple Electron app
https://electronjs.org/docs/latest/tutorial/quick-start
Creative Commons Zero v1.0 Universal
11.13k stars 4.93k forks source link

Got stuck on postinstall #127

Closed haxpor closed 7 years ago

haxpor commented 7 years ago

Got stuck on

> electron@1.4.15 postinstall /Volumes/Slave/scrap/electron-quick-start/node_modules/electron
> node install.js

I wait for it long enough before submitting this issue.

I have node v7.4.0, and npm 4.0.5.

lkytal commented 7 years ago

Same here, no idea why

haxpor commented 7 years ago

I just re-test again and it works now. I remember I executed npm set registry https://registry.npmjs.org/ and then npm install again on electron quick start project. But still need to wait a little bit.

See if that works for you.

devarrns commented 7 years ago

same here. @haxpor i did what you said, but still stuck on.

perprit commented 7 years ago

i did what @haxpor did and install has finished in about 20 minutes. thanks!

ronyth commented 7 years ago

This happened to me too, I found the problem is bad internet connection to github.com, I tried to download .zip files and it just got < 10KB/s. When I switch to another ISP (download .zip about 300KB/s), the installation success within seconds.

CK110 commented 7 years ago

same issue , promote:electron-quick-start CK$ npm install

electron@1.6.5 postinstall electron-quick-start/node_modules/electron node install.js

/Users/CK/Documents/github/electron/electron-quick-start/node_modules/electron/install.js:47 throw err ^

Error: connect ETIMEDOUT 52.216.1.240:443 at Object.exports._errnoException (util.js:1050:11) at exports._exceptionWithHostPort (util.js:1073:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)

MarshallOfSound commented 7 years ago

@CK110 That error is a network issue on your side of things, try downloading electron on a different network

CK110 commented 7 years ago

@MarshallOfSound But i can npm install other package

MarshallOfSound commented 7 years ago

@CK110 Sure, but the electron package downloads extra (reasonably large) binaries from github releases

rogercorrea commented 7 years ago

I have the same problem but when I execute the "npm install" script the console show the download and extracted packages but after are frozen in other line: "node install.js".

Now are 20 minutes waiting and I received nothing still. It's normal?

Thanks!

CK110 commented 7 years ago

@rogercorrea ,l try with cpm and and it works now 。maybe you can try , https://cnpmjs.org/

zeke commented 7 years ago

Looks like this was another case of flaky networks.

Olatunji-Longe commented 7 years ago

I had this issue too... Turned out that it was caused by version incompatibilities between my Node.js and electron. Once I changed my versions to conform to what was shown on electron website landing page (see image below), npm install took a little over 1 second.

electron-note

Yousuf-Basir commented 7 years ago

I ran the powershell in Admin mode, then it worked and it took about 7-8 minute to complete the installation. :)

adeluccar commented 7 years ago

Hey @zeke, maybe add an echo somewhere in the install.js 'downloading binaries'? I also thought it was stuck (and yes, it was another case of flaky networks). ;-)

zeke commented 7 years ago

maybe add an echo somewhere in the install.js 'downloading binaries'

I like this idea. We could even take it a step further by adding something helpful for the reader to see while waiting...

MarshallOfSound commented 7 years ago

@zeke We used to show the download progress but we turned it off for some reason a while back

EDIT: https://github.com/electron-userland/electron-prebuilt/pull/202

adeluccar commented 7 years ago

@marshallofsound Interesting trade off, I can see why PR#202 would be merged. I'm not sure what the right way to go about this conundrum would be. On one hand, I favor silent “install” scripts. On the other, this one does download some heavier stuff. Seems to me like UX wise, and adoption wise, it makes sense to let people know that in some way. @zeke

ghost commented 7 years ago

Since this project is mainly for luring people to use electron, adding a progress bar for npm install is vital. If I followed the guide of https://electron.atom.io/, got stuck, retired several times, googled it, and ended up here with no official solution, then how many people do you think will just give up trying Electron then?

ghost commented 7 years ago

In Short, to install election globally, I guess we can try:

  1. Dun use sudo npm, instead fix the npm global install issue (see https://docs.npmjs.com/getting-started/fixing-npm-permissions) (I did Option 2)
  2. Do the following
    $ npm uninstall -g electron
    $ npm install -g --verbose electron

    Done (Hopefully).

Long Story Behind: For me I encountered this issue when try to install react-devtools which needs electron (for details https://github.com/facebook/react-devtools/issues/741), so I do the following:

It seems like sudo npm is a bad thing to do, so firstly I fix the permission issue with npm global install (see https://docs.npmjs.com/getting-started/fixing-npm-permissions) (I did Option 2), after that I executed below:

$ npm uninstall -g react-devtools
$ npm uninstall -g electron
$ npm install -g --verbose react-devtools

Then the terminal will show the downloading process:

screen shot 2017-09-14 at 11 15 05 am

For me it was done within 5 minutes, and then $ react-devtools works.

So I guess for installing electron only, we can simply do $ npm install -g --verbose electron Cheers.

OrDuan commented 7 years ago

Thanks @ghost, to see the download progress just use: npm install -g --verbose electron

For me it downloaded it 10-50 kb/s probably because of bad internet connection.

ssehacker commented 7 years ago

add ELECTRON_MIRROR env before you run npm install electron.

# Electron mirror for China
ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"

# Local mirror
# Example of requested URL: http://localhost:8080/1.2.0/mksnapshot-v1.2.0-darwin-x64.zip
ELECTRON_MIRROR="http://localhost:8080/"

more information : https://github.com/electron/mksnapshot

DollarAkshay commented 6 years ago

npm install --verbose to see the download progress

jimfilippou commented 6 years ago

Buy an ssd, and a high speed internet connection and boom solved

search2074 commented 6 years ago

Solved, you need to wait: `F:\n\electron-quick-start>npm install

electron@1.7.9 postinstall F:\n\electron-quick-start\node_modules\electron node install.js

added 152 packages in 1014.082s`

Yoomin233 commented 6 years ago

for Chinese users:

touch .npmrc
.npmrc -> electron_mirror=https://npm.taobao.org/mirrors/electron/
santiagoalmeidabolannos commented 6 years ago

do this and you will see the problem npm -g --verbose install electron, the postinstall is downloading a file and you can see the progress using --verbose

EstebanBorai commented 6 years ago

Running it on Windows 10 did just fine after opening the PowerShell as Admin and then I installed the electron package globally as @santiagoalmeidabolannos did! npm -g --verbose install electron. It will take a while for sure but It will work.

Pipe-Runner commented 6 years ago

The verbose argument actually gives you peace of mind as you can see what install.js is doing. I thought it was stuck but apparently, my college internet was slow, so it was taking time to download. Thumbs up for the idea....

samuelhmorgan commented 6 years ago

It works when I run powershell in admin mode (also enabled verbose)

abhipanda commented 6 years ago

Downloading tmp-34484-0-electron-v3.0.0-darwin-x64.zip [===> ] 9.2% of 50.16 MB (20.4 kB/s)

legend80s commented 4 years ago

npm install electron stuck on node install.js

After debugging the electron/install.js, I found my solution.

  1. Download the electron zip from github or in China from https://npm.taobao.org/mirrors/electron/.
  2. In electron's default cache folder mkdir an versioned cache folder and move the zip into it.
  3. Goto you project folder trynpm install electron@xxx --save-dev.
  4. Validate: node_modules/.bin/electron -v

Take MacOS x64 electron@v7.0.1(latest one at 2019-11-04)as example:

  1. download manually or using wget from https://npm.taobao.org/mirrors/electron/7.0.1/electron-v7.0.1-darwin-x64.zip

    cd ~/Library/Caches/electron/
    
    wget https://npm.taobao.org/mirrors/electron/7.0.1/electron-v7.0.1-darwin-x64.zip

    image

  2. Make a weird but normalized cache folder, which is found by debugging.

    # in ~/Library/Caches/electron/ mkdir this weird thing
    mkdir httpsgithub.comelectronelectronreleasesdownloadv7.0.1electron-v7.0.1-darwin-x64.zip
    
    # mv the downloaded zip into the versioned folder
    mv ../electron-v7.0.1-darwin-x64.zip ./
  3. Install in your project. Now fast as a rocket 🚀!

    cd /path/to/your_project
    
    npm install electron@7.0.1 --save-dev
  4. Validate 🎉

    # in you project folder
    node_modules/.bin/electron -v
    
    # output
    # v7.0.1
tmnuwan12 commented 4 years ago

npm install electron stuck on node install.js

After debugging the electron/install.js, I found my solution.

  1. Download the electron zip from github or in China from https://npm.taobao.org/mirrors/electron/.
  2. In electron's default cache folder mkdir an versioned cache folder and move the zip into it.
  3. Goto you project folder trynpm install electron@xxx --save-dev.
  4. Validate: node_modules/.bin/electron -v

Take MacOS x64 electron@v7.0.1(latest one at 2019-11-04)as example:

  1. download manually or using wget from https://npm.taobao.org/mirrors/electron/7.0.1/electron-v7.0.1-darwin-x64.zip

    cd ~/Library/Caches/electron/
    
    wget https://npm.taobao.org/mirrors/electron/7.0.1/electron-v7.0.1-darwin-x64.zip

    image

  2. Make a weird but normalized cache folder, which is found by debugging.

    # in ~/Library/Caches/electron/ mkdir this weird thing
    mkdir httpsgithub.comelectronelectronreleasesdownloadv7.0.1electron-v7.0.1-darwin-x64.zip
    
    # mv the downloaded zip into the versioned folder
    mv ../electron-v7.0.1-darwin-x64.zip ./
  3. Install in your project. Now fast as a rocket 🚀!

    cd /path/to/your_project
    
    npm install electron@7.0.1 --save-dev
  4. Validate 🎉

    # in you project folder
    node_modules/.bin/electron -v
    
    # output
    # v7.0.1

Use this link https://www.electronjs.org/docs/tutorial/installation#cache on how to setup the electron cache folder to setup the installation. This method actually fixed the stuck installation issue I was having in Windows.

Admingyu commented 3 years ago

For me(chinese user), I solved by edit ~/.npmrc(create it if not exists:

vim ~/.npmrc

Add/Replace registry & electron_mirror as follow:

registry=https://registry.npm.taobao.org
electron_mirror=https://npm.taobao.org/mirrors/electron/

and save have a try

leotaozeng commented 3 years ago

For me(Chinese user), I solved by edit ~/.npmrc(create it if not exists:

vim ~/.npmrc

Add/Replace registry & electron_mirror as follow:

registry=https://registry.npm.taobao.org
electron_mirror=https://npm.taobao.org/mirrors/electron/

and save have a try

Thanks very much. It saved my day.

edgexie commented 1 year ago

now for chinese users, can use ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/" reference