You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

安装Electron@6.0.10时终端卡顿,更换Node版本仍未解决

Fixing Electron 6.0.10 Postinstall Hang on Windows

Hey there, I’ve run into this exact kind of issue before—when the Electron postinstall script gets stuck on node install.js, it almost always boils down to problems downloading the Electron binary package. Let’s walk through some practical fixes to get you up and running:

1. Use a Domestic Mirror to Speed Up Downloads

The default download source for Electron is GitHub, which can be slow or blocked in some regions. Switching to a mirror will usually resolve the hang:

  • Temporary fix for this install: Run this command directly in your project folder:
    npm install electron@6.0.10 --electron_mirror=https://npm.taobao.org/mirrors/electron/
    
  • Permanent fix for future installs: Set the mirror globally so you don’t have to repeat it every time:
    npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
    
    Then run your original install command again: npm install electron@6.0.10

2. Clear Cache and Start Fresh

Sometimes corrupted cache files can cause the install to hang. Let’s reset things:

  • First, clear the npm cache:
    npm cache clean --force
    
  • Delete the node_modules folder and package-lock.json file from your project directory
  • Re-run the install command: npm install

3. Manually Download and Place the Binary

If the mirror still doesn’t work, you can grab the binary yourself:

  • Download the correct Electron 6.0.10 package for your Windows system: electron-v6.0.10-win32-x64.zip
  • Create a dist folder inside C:\Users\PC\Desktop\project\node_modules\electron (if it doesn’t exist)
  • Unzip the downloaded zip file into this dist folder
  • Set an environment variable to skip automatic download:
    set ELECTRON_SKIP_BINARY_DOWNLOAD=1
    
  • Finally, run the install script manually:
    node node_modules/electron/install.js
    

4. Check Proxy Settings

If you’re on a network that uses a proxy, make sure npm is configured correctly:

  • To set a proxy:
    npm config set proxy http://your-proxy-address:port
    npm config set https-proxy http://your-proxy-address:port
    
  • If you don’t need a proxy, clear existing settings:
    npm config delete proxy
    npm config delete https-proxy
    

Give these steps a try in order—most folks fix the issue with the mirror or cache clear. Let me know if you hit any snags along the way!

内容的提问来源于stack exchange,提问作者Amir Makram

火山引擎 最新活动