SOLFIND
Web Lens
Portal home

Advanced Installation Instructions | Electron

https://www.electronjs.org/docs/latest/tutorial/installation • 47 KB fetched
Open original page


Advanced Installation Instructions | Electron Skip to main content Electron Docs API Blog Tools * Electron Forge * Electron Fiddle Community * Governance * Showcase * Resources Releases English * English * Deutsch * Español * Français * 日本語 * Português * Русский * 中文 Search * Get Started * Processes in Electron * Best Practices * Examples * Development * Accessibility * Advanced Installation Instructions * ASAR Archives * ASAR Integrity * Boilerplates and CLIs * ES Modules (ESM) in Electron * Electron Fuses * Window State Persistence * Windows on ARM * Native Node Modules * Distribution * Testing And Debugging * References * Contributing * * Development * Advanced Installation Instructions On this page Advanced Installation Instructions To install prebuilt Electron binaries, use npm . The preferred method is to install Electron as a development dependency in your app: npm install electron --save-dev See the Electron versioning doc for info on how to manage Electron versions in your apps. Binary download step ​ Under the hood, Electron's JavaScript API binds to a binary that contains its implementations. This binary is crucial to the function of any Electron app, and is downloaded by default the first time you run Electron in development mode (i.e. electron . ). If you want to install the binary on demand instead, you can run the install-electron bin script included in the electron package: npx install-electron --no Installing prereleases ​ Electron distributes experimental releases of future major versions via npm as well. Nightly builds contain the latest changes from the main branch: npm install electron-nightly --save-dev Alpha and beta builds contain changes slated for the next major version: npm install electron@alpha --save-dev npm install electron@beta --save-dev tip For more information on available Electron releases, see the Release Status dashboard . Running Electron ad-hoc ​ If you're in a pinch and would prefer to not use npm install in your local project, you can also run Electron ad-hoc using the npx command runner bundled with npm : npx electron . The above command will run the current working directory with Electron. Note that any dependencies in your app will not be installed. Customization ​ If you want to change the architecture that is downloaded (e.g., x64 on an arm64 machine), you can set the ELECTRON_INSTALL_ARCH environment variable: # Inside an npm script or with npx ELECTRON_INSTALL_ARCH=x64 electron . Supported architectures are a subset of Node.js process.arch values, and include: * x64 (Intel Mac and 64-bit Windows) * arm64 (Apple silicon, Windows on ARM, ARM64 Linux) In addition to changing the architecture, you can also specify the platform (e.g., win32 , linux , etc.) using the --platform flag: # Inside an npm script or with npx ELECTRON_INSTALL_PLATFORM=mas electron . Supported platforms are Node-like platform strings : * darwin * mas ( Mac App Store ) * win32 * linux tip To see all available platform/architecture combinations for a particular release, see the artifacts on Electron's GitHub Releases . Proxies ​ If you need to use an HTTP proxy, you need to set the ELECTRON_GET_USE_PROXY variable to any value, plus additional environment variables depending on your host system's Node version: * Node 10 and above * Before Node 10 Custom mirrors and caches ​ During installation, the electron module will call out to @electron/get to download prebuilt binaries of Electron for your platform. It will do so by contacting GitHub's release download page ( https://github.com/electron/electron/releases/tag/v$VERSION , where $VERSION is the exact version of Electron). If you are unable to access GitHub or you need to provide a custom build, you can do so by either providing a mirror or an existing cache directory. Mirror ​ You can use environment variables to override the base URL, the path at which to look for Electron binaries, and the binary filename. The URL used by @electron/get is composed as follows: url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAME For instance, to use the China CDN mirror: ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/" By default, ELECTRON_CUSTOM_DIR is set to v$VERSION . To change the format, use the {{ version }} placeholder. For example, version-{{ version }} resolves to version-5.0.0 , {{ version }} resolves to 5.0.0 , and v{{ version }} is equivalent to the default. As a more concrete example, to use the China non-CDN mirror: ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/" ELECTRON_CUSTOM_DIR="{{ version }}" The above configuration will download from URLs such as https://npmmirror.com/mirrors/electron/8.0.0/electron-v8.0.0-linux-x64.zip . If your mirror serves artifacts with different checksums to the official Electron release you may have to set electron_use_remote_checksums=1 directly, or configure it in a .npmrc file, to force Electron to use the remote SHASUMS256.txt file to verify the checksum instead of the embedded checksums. Cache ​ Alternatively, you can override the local cache. @electron/get will cache downloaded binaries in a local directory to not stress your network. You can use that cache folder to provide custom builds of Electron or to avoid making contact with the network at all. * Linux: $XDG_CACHE_HOME or ~/.cache/electron/ * macOS: ~/Library/Caches/electron/ * Windows: $LOCALAPPDATA/electron/Cache or ~/AppData/Local/electron/Cache/ On environments that have been using older versions of Electron, you might find the cache also in ~/.electron . You can also override the local cache location by providing a electron_config_cache environment variable. The cache contains the version's official zip file as well as a checksum, and is stored as [checksum]/[filename] . A typical cache might look like this: ├── a91b089b5dc5b1279966511344b805ec84869b6cd60af44f800b363bba25b915 │ └── electron-v15.3.1-darwin-x64.zip Troubleshooting ​ When running npm install electron , some users occasionally encounter installation errors. In almost all cases, these errors are the result of network problems and not actual issues with the electron npm package. Errors like ELIFECYCLE , EAI_AGAIN , ECONNRESET , and ETIMEDOUT are all indications of such network problems. The best resolution is to try switching networks, or wait a bit and try installing again. You can also attempt to download Electron directly from electron/electron/releases if installing via npm is failing. If installation fails with an EACCESS error you may need to fix your npm permissions . If the above error persists, the unsafe-perm flag may need to be set to true: sudo npm install electron --unsafe-perm=true On slower networks, it may be advisable to use the --verbose flag in order to show download progress: npm install --verbose electron If you need to force a re-download of the asset and the SHASUM file set the force_no_cache environment variable to true . Edit this page Previous Accessibility Next ASAR Archives * Binary download step * Installing prereleases * Running Electron ad-hoc * Customization * Proxies * Custom mirrors and caches * Mirror * Cache * Troubleshooting Docs * Getting Started * API Reference Checklists * Performance * Security Tools * Electron Forge * Electron Fiddle Community * Governance * Resources * Bluesky * X * Mastodon * Stack Overflow More * GitHub * Open Collective * Infrastructure Dashboard Copyright OpenJS Foundation and Electron contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation , please see our Trademark Policy and Trademark List . Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. The OpenJS Foundation | Terms of Use | Privacy Policy | Bylaws | Code of Conduct | Trademark Policy | Trademark List | Cookie Policy Hosting and infrastructure graciously provided by

Links found on this page

  1. Skip to main content [direct]
  2. Electron [direct]
  3. Docs [direct]
  4. API [direct]
  5. Blog [direct]
  6. Electron Forge [direct]
  7. Electron Fiddle [direct]
  8. Governance [direct]
  9. Showcase [direct]
  10. Resources [direct]
  11. Releases [direct]
  12. Deutsch [direct]
  13. Español [direct]
  14. Français [direct]
  15. 日本語 [direct]
  16. Português [direct]
  17. Русский [direct]
  18. 中文 [direct]
  19. Processes in Electron [direct]
  20. Best Practices [direct]
  21. Examples [direct]
  22. Development [direct]
  23. ASAR Archives [direct]
  24. ASAR Integrity [direct]
  25. Boilerplates and CLIs [direct]
  26. ES Modules (ESM) in Electron [direct]
  27. Electron Fuses [direct]
  28. Window State Persistence [direct]
  29. Windows on ARM [direct]
  30. Native Node Modules [direct]
  31. Distribution [direct]
  32. Testing And Debugging [direct]
  33. References [direct]
  34. Contributing [direct]
  35. npm [direct]
  36. Electron versioning doc [direct]
  37. distributes experimental releases of future major versions [direct]
  38. npx [direct]
  39. process.arch [direct]
  40. Mac App Store [direct]
  41. Electron's GitHub Releases [direct]
  42. Node 10 and above [direct]
  43. Before Node 10 [direct]
  44. @electron/get [direct]
  45. fix your npm permissions [direct]
  46. unsafe-perm [direct]
  47. Edit this page [direct]
  48. Security [direct]
  49. Bluesky [direct]
  50. X [direct]
  51. Mastodon [direct]
  52. Stack Overflow [direct]
  53. GitHub [direct]
  54. Open Collective [direct]
  55. Infrastructure Dashboard [direct]
  56. OpenJS Foundation [direct]
  57. Trademark Policy [direct]
  58. Trademark List [direct]
  59. Terms of Use [direct]
  60. Privacy Policy [direct]
  61. Bylaws [direct]
  62. Code of Conduct [direct]
  63. Cookie Policy [direct]