Skip to main content

安装 Electron (npm install electron)

· 5 min read

从 Electron 版本 1.3.1 开始,你可以使用 npm install electron --save-dev 在你的应用中安装最新的预编译版本的 Electron。

🌐 As of Electron version 1.3.1, you can npm install electron --save-dev to install the latest precompiled version of Electron in your app.


npm install electron

预构建的 Electron 二进制文件

🌐 The prebuilt Electron binary

如果你以前用过 Electron 应用,你可能已经接触过 electron-prebuilt npm 包。这个包几乎是每个 Electron 项目不可或缺的一部分。安装后,它会检测你的操作系统,并下载一个为你的系统架构编译的预构建二进制文件。

🌐 If you've ever worked on an Electron app before, you've likely come across the electron-prebuilt npm package. This package is an indispensable part of nearly every Electron project. When installed, it detects your operating system and downloads a prebuilt binary that is compiled to work on your system's architecture.

新名称

🌐 The new name

Electron 的安装进程常常是新开发者的绊脚石。许多勇敢的人尝试通过运行 npm install electron 而不是 npm install electron-prebuilt 来开始开发 Electron 应用,结果发现(通常是在经历了很多困惑之后)这并不是他们想要的 electron

🌐 The Electron installation process was often a stumbling block for new developers. Many brave people tried to get started developing an Electron by app by running npm install electron instead of npm install electron-prebuilt, only to discover (often after much confusion) that it was not the electron they were looking for.

这是因为在 GitHub 的 Electron 项目存在之前,npm 上已经有一个现存的 electron 项目。为了帮助新开发者更轻松、更直观地开发 Electron,我们联系了现有 electron npm 包的拥有者,询问他是否愿意让我们使用这个名字。幸运的是,他是我们项目的粉丝,并同意帮助我们重新利用这个名字。

🌐 This was because there was an existing electron project on npm, created before GitHub's Electron project existed. To help make Electron development easier and more intuitive for new developers, we reached out to the owner of the existing electron npm package to ask if he'd be willing to let us use the name. Luckily he was a fan of our project, and agreed to help us repurpose the name.

预构建版本仍在运行

🌐 Prebuilt lives on

从版本 1.3.1 开始,我们已经开始将 electronelectron-prebuilt 软件包同时发布到 npm。这两个软件包是相同的。我们选择在一段时间内继续以两个名字发布该软件包,以免给目前在其项目中使用 electron-prebuilt 的数千名开发者带来不便。我们建议将你的 package.json 文件更新为使用新的 electron 依赖,但我们将在 2016 年底之前继续发布 electron-prebuilt 的新版本。

🌐 As of version 1.3.1, we have begun publishing electron and electron-prebuilt packages to npm in tandem. The two packages are identical. We chose to continue publishing the package under both names for a while so as not to inconvenience the thousands of developers who are currently using electron-prebuilt in their projects. We recommend updating your package.json files to use the new electron dependency, but we will continue releasing new versions of electron-prebuilt until the end of 2016.

electron-userland/electron-prebuilt 仓库将继续作为 electron npm 包的官方存储库。

🌐 The electron-userland/electron-prebuilt repository will remain the canonical home of the electron npm package.

非常感谢

🌐 Many thanks

我们特别感谢 @mafintosh@maxogden 以及许多其他 贡献者 创建和维护 electron-prebuilt,以及他们对 JavaScript、Node.js 和 Electron 社区的不懈贡献。

🌐 We owe a special thanks to @mafintosh, @maxogden, and many other contributors for creating and maintaining electron-prebuilt, and for their tireless service to the JavaScript, Node.js, and Electron communities.

感谢 @logicalparadox 允许我们接管 npm 上的 electron 包。

🌐 And thanks to @logicalparadox for allowing us to take over the electron package on npm.

更新你的项目

🌐 Updating your projects

我们已与社区合作,更新受此更改影响的热门软件包。像 electron-packagerelectron-rebuildelectron-builder 这样的软件包已经更新,以支持新名称,同时继续支持旧名称。

🌐 We've worked with the community to update popular packages that are affected by this change. Packages like electron-packager, electron-rebuild, and electron-builder have already been updated to work with the new name while continuing to support the old name.

如果在安装此新软件包时遇到任何问题,请通过在 electron-userland/electron-prebuilt 仓库中提交问题告知我们。

🌐 If you encounter any problems installing this new package, please let us know by opening an issue on the electron-userland/electron-prebuilt repository.

对于 Electron 的其他问题,请使用 electron/electron 仓库。

🌐 For any other issues with Electron, please use the electron/electron repository.