Electron installation Errors

  1. Fail to install Electron
  2. Build errors
  3. ERROR: Cannot create symbolic link
  4. Sandbox issue
  5. npm warn Unknown project config “ELECTRON_MIRROR”

Electron is a framework for building desktop applications using JavaScript, HTML and CSS.

Fail to install Electron

When you are following the tutorial on the official website, you might have problems when you try to install the electron package:

1
npm install electron --save-dev

You might come across error messages such as Electron RequestError: connect ETIMEDOUT 20.205.243.166:443. This problem is so common that many developers are asking the same question all the time, even the official document has given their solution.

To summarise, if you are a developer who is living in China, you can simply create a .npmrc in your project root folder, then add this line into the file:

1
ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"

Save and close the file. Try the command above again, you should be able to install Electron now.

Alternatively, you can also set NPM config settings by running:

1
2
3
4
5
# yarn
yarn config set electron_mirror https://npmmirror.com/mirrors/electron/

# npm
npm config set ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/

Build errors

1
https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z": dial tcp 20.205.243.166:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Solution: Configure proxy in npm

1
2
npm config set proxy http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890

Solution:

This error usually happens on Windows when electron-builder tries to create a symbolic link (symlink) during packaging.

By default, electron-builder sometimes uses symlinks to save space in node_modules. But on Windows:

  • Symlinks need Administrator privileges, or
  • Developer Mode must be enabled in Windows 10/11.

Solution: Enable Windows Developer Mode (recommended)

  • Open SettingsPrivacy & SecurityFor Developers.
  • Turn on Developer Mode.
  • This allows symlink creation without needing admin.

Sandbox issue

You may have this sandbox issue while starting your electron apps:

1
2
[4998:0909/201959.792204:FATAL:sandbox/linux/suid/client/setuid_sandbox_host.cc:166] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/username/Public/my-electron-app/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.
/home/username/Public/my-electron-app/node_modules/electron/dist/electron exited with signal SIGTRAP

Solution 1: Set the SUID permission on chrome-sandbox (recommended)

Run these commands:

1
2
3
4
5
6
# Navigate to your project directory
cd /home/username/Public/my-electron-app

# Set ownership to root and set SUID permissions
sudo chown root:root node_modules/electron/dist/chrome-sandbox
sudo chmod 4755 node_modules/electron/dist/chrome-sandbox

Solution 2: Run with sandbox disabled (Temporary fix)

It’s the easiest way but not recommended for production.

1
2
# Run Electron with sandbox disabled
electron . --no-sandbox

npm warn Unknown project config “ELECTRON_MIRROR”

The ELECTRON_MIRROR warning is because npm is moving away from allowing arbitrary config names in .npmrc.

To fix the npm warning, we can Set the mirror directly in the start script:

1
2
3
4
5
{
"scripts": {
"start": "ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm start"
}
}