This article mainly introduces the quick installation process under Nodejs and Electron ubuntu. It has certain reference value. Now I share it with you. Friends in need can refer to it.
I found it when I was looking for time management software. I got the superProductivity program and used electron to develop it, so I read the introduction and felt itchy. I tried to build the environment and slowly complete the front-end knowledge step by step.
nodejs installation
The version of nodejs is updated quickly, so there may be multiple versions on one system, and the management tools can also be diverse. I chose to use nvm for installation. One reason is that management is simple. , the other is that you don’t need to install nodejs first and then upgrade.
1. Install nvm
First check the version of nvm, and then replace the version information in the following script address to obtain nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.10/install.sh | bash
2. Check the nvm version
nvm -v
3. If nvm cannot be found, it should generally be a configuration problem. In ~/.bash.rc ~/.profile or ~/.bash_profile Check if there are the following words,
export NVM_DIR="/home/carl/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
4. Install node
Check the version of node that can be installed
nvm ls-remote
Of course, you can use a variety of installation methods, such as
××install stable version
nvm install stable
××Install a specific version. The version number can be found from the results in View Version above.
nvm install 8.11.1
××View the current node version
nvm current
××View all node version
nvm ls
××Switch version
nvm use 8.11.1
##Install electron
Many installations of electron on the Internet use npm, but there is a problem with the execution here. The installation failed and the prompt was a permission issue. I have used sudo to install it. It may be that the network or configuration is not correct. There is no need to do it here. After struggling with the above, I checked the online method and chose cnpm to install it. Of course, you can also try to see if it can be installed××npm安装 sudo npm install electron --save-dev --save-exact ××cnpm安装 npm install -g cnpm --registry=https://registry.npm.taobao.org ××使用cnpm进行安装,使用方法和npm相同 cnpm install -g electron
The above is the detailed content of Quick installation process under Nodejs and Electron ubuntu. For more information, please follow other related articles on the PHP Chinese website!