Installation of Nodejs and NPM in Ubuntu environment

Source: Internet
Author: User
Tags nodesource

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.

$ 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.

$ 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.

$ sudo apt-get install nodejs

After the installation is complete, we look at the versions of Nodejs and NPM.

$ node -vv8.5.0$ npm -vv5.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.

$ npm install -g nrm

After the installation is complete, list the available software sources

$ nrm ls* npm ---- https://registry.npmjs.org/  cnpm --- http://r.cnpmjs.org/  taobao - https://registry.npm.taobao.org/  nj ----- https://registry.nodejitsu.com/  rednpm - http://registry.mirror.cqupt.edu.cn/  npmMirror  https://skimdb.npmjs.com/registry/  edunpm - http://registry.enpmjs.org/

At home, we can use the source of Taobao, the speed is relatively good.

$ nrm use taobaoRegistry has been 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.

$ npm config set proxy http://127.0.0.1:3128$ npm config set http-proxy http://127.0.0.1:3128$ npm config set 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.