Ext. 78005038
node. JS is a JAVASCRIPT runtime environment based on the Chrome V8 engine that uses an event-driven, non-blocking I/O model to make it lightweight and efficient.
node. JS's Package Manager NPM, the world's largest open source library ecosystem, features and is powerful.
This article describes how to install the node environment in an Ubuntu environment.
The system I use is Ubuntu 16.04, but it should also work in other versions of the system.
Installing Python-software-properties
The first step is to install the dependent package python-software-properties.
1 $ sudo apt-get Install Python-software-properties
Add PPA
Website Deb.nodesource.com maintains the PPA for each version of the Nodejs installation package, which we can download from the website to perform the import.
1 $ curl-sl https://deb.nodesource.com/setup_8.x | sudo-e Bash-
If you are prompted not to have curl installed, you need to install Curl first.
The current 6.x version is a more stable version, we can choose to install the different version according to our own needs.
Installing Nodejs and NPM
Next install the Nodejs, and NPM will install it automatically after the installation is complete.
1 $ sudo apt-get Install Nodejs
After the installation is complete, we look at the versions of Nodejs and NPM.
1 $ node-v2 V8. 5.0 3 $ npm-v4 v5. 3.0
Configuring the NPM Warehouse
Because the domestic network environment, directly from the NPM official source installs the package speed is slow, even causes the installation to be unsuccessful.
We can install the NRM tool to manage the source of the software.
1 $ npm install-g NRM
After the installation is complete, list the available software sources
1 $ NRM ls2* NPM----https://registry.npmjs.org/3CNPM---http://r.cnpmjs.org/4Taobao-https://registry.npm.taobao.org/5NJ-----https://registry.nodejitsu.com/6Rednpm-http://registry.mirror.cqupt.edu.cn/7Npmmirror https://skimdb.npmjs.com/registry/8Edunpm-http://registry.enpmjs.org/
At home, we can use the source of Taobao, the speed is relatively good.
1 $ NRM Use Taobao 2 3 set To:https://registry.npm.taobao.org/
Configure agents
In addition, if you need to configure the agent in a specific network environment, you can configure it with the following command.
1 Set proxy http://127.0.0.1:31282set http-proxy http:// 127.0.0.1:31283set https-proxy https://127.0.0.1:3128
The method of configuring the agent is also applicable in a Windows environment.
Installation of Nodejs and NPM in Ubuntu environment