Install electron development environment under UOS

Regarding the installation of the domestic operating system UOS, it has been posted everywhere. I am disgusted by the meaningless forwarding. I just happened to be doing a project using electron, so the first CSDN blog post starts with installing electron in the UOS operating system.

Installation aids

Installing electron requires some auxiliary tools, such as git, etc. Although I have not posted the tutorial steps for installing UOS (although it is very simple), this blog post still starts from the new installation of the UOS system:

First, let’s list the auxiliary tools that need to be installed:

1) git // We need to use git to download the electron sample code

2) npm //Use npm to download and install cnpm

3) cnpm //Download and install electron

4) nodejs //electron is run based on nodejs

Okay, let’s start installing these auxiliary tools. The coolest thing in Linux is to use the terminal to install various software. This is different from Windows. You don’t have to go all over the world to find installation software to download. You only need one command to download and install. Everything is ready . Installing it like this in front of a girl is like installing an X artifact.

The terminal provided by UOS by default is super easy to use. Among many LINUX distributions, the terminal that comes with UOS by default is the best to use. The character color scheme is cool and very practical. Without further ado, press Ctrl+Alt+T key to start the terminal.

Next type the first command:

 sudo apt install git

Because the sudo command is used, you need to enter the password of the root user according to the prompts. During the installation process, you will be prompted whether to install. The APT that comes with UOS gives a thoughtful reminder ** (Y/n) **The letter Y is capitalized, which means that pressing Enter directly confirms the installation. Press Enter and wait. It only takes a moment to install git. As for what this git is used for, please search it yourself.

Then start installing the second tool:

sudo npm install cnpm

Some friends may have noticed that this time a parameter **-y** has been added, which actually sets the confirmation steps during the installation process to the default, no longer asks, and installs directly.

Next is the third tool:

sudo apt install -y nodejs
node -v

This step takes a little longer, just wait a little longer. After the installation is completed, you can execute the command on line 4 to test it. If it is normal, the nodejs version number should be displayed. If the display result is abnormal, please check and try again. Perform the command on line 3

Then we need to start installing cnpm using the npm installed in the second step:

sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
 

The specific process is the same as installing with apt.

Finally we have reached the most critical step, use cnpm to install electron:

sudo cnpm install -g [email protected]
electron -v 

The latest electron is 8.2.0, but I don’t know why I always get errors after installing 8.2.0. Maybe the new version is unstable, so the next best thing is to install 8.1.1. After the installation is completed, use the command on line 7 to test. Some students may make errors and prompt that the permissions are insufficient. This may be a defect of the cnpm installation program. We need to fix it manually:

sudo sudo chmod 4755 /usr/local/lib/node_modules/electron/dist/chrome-sandbox
electron -v

Haha, we finally see the light of day. Electron is ready to run. Next, let’s download a piece of code to test it:

cd ~          //回到用户主目录
git clone https://github.com/electron/electron-quick-start   //使用git工具下载electron的测试代码
cd electron-quick-start/     //进入下载的代码目录     
npm start                    //用npm启动这段代码

Very good, now a normal window has popped up, showing "hello Word!"

It shows that we can happily develop electron under UOS. Of course, we also need to install some auxiliary software such as code editors, such as vs code. This has been integrated in the software store in UOS. You can install it directly. Of course, you can also use the terminal and command line to install. Isn’t UOS very easy to install? It's powerful, come and experience it.

sudo apt install com.visualstudio.code

Reprinted from: Diary of a rookie entering UOS--Installing electron development environment under UOS_Ruoshui Sanqian's blog-CSDN blog 

Guess you like

Origin blog.csdn.net/fuhanghang/article/details/132837190