In this section, we will learn the installation of Electron
To install Electron
, you first need to ensure that Node.js
has been installed locally.
Node.js installation
Node.js
official website address: https://nodejs.org/en/, into the official web surface are as follows:
It is recommended to download the LTS
version. After downloading, execute the installation program and complete the installation according to the guide.
After the installation is complete, we need to confirm Node.js
can work normally. You can check whether the installation is successful by entering the following command in the command line tool:
$ node -v
$ npm -v
As shown in the figure below, if the two commands both display the version number, the installation is successful, because Node.js
has been updated, you can download the latest version on the official website:
Electron installation
To install the pre-compiled binary file, we can use the npm
command to install it. The installation command is as follows:
npm install electron --save-dev
In this installation command, --save-dev
means to install the module into the project directory, and write dependencies in the devDependencies
node of the package.json
Or we can choose to install globally. For global installation, you need to add a -g
to the command:
npm install electron -g
As shown below:
Use npm
to get very slow speed. It is recommended to npm
the warehouse of 060b4c8c1f1a1f to the domestic Taobao warehouse and register the cnpm
command:
npm install -g cnpm --registry=https://registry.npm.taobao.org
Then use cnpm
to install:
cnpm install electron -g
Check whether the installation is successful
After installation, we can check electron
-v
command, the command is as follows:
> electron -v
as the picture shows:
Install packaged output tool
In order to facilitate the output of the final results, it is recommended to install the electron-packager
tool. The installation is also very simple. It is recommended to install globally with the following command:
npm install -g electron-packager
Results as shown below:
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。