After building and installing node based on the previous blog post, start to build the electron environment in the linux environment
1. Install cnpm
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
After the installation is complete, if you want to use cnpm globally, you must establish a soft connection
sudo ln -s /usr/local/node/lib/node_modules/cnpm /usr/local/bin/cnpm
Install cnpm successfully
2. If the npm installation speed is acceptable, the first step can be ignored, and the second step is to install electron. Most of the installations have errors such as permission denied (permission denied).
cnpm i --unsafe -perm
sudo cnpm install -g electron --unsafe-perm
After the installation is successful, find the corresponding directory and run the command
sudo node install.js
Establish a soft link
sudo ln -s /usr/local/node/lib/node_modules/electron/dist/electron /usr/local/bin/electron
The above picture shows that the installation is successful, and then run electron in your own project. You can start your own project