Installation and use of Nvm,node and NPM under Ubuntu

Source: Internet
Author: User
Tags install node git clone

One: Install NVM

First download NVM, here we need to use git, if Git is not installed, you can use

sudo apt-get install git
To install

git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout ' git describe--abbrev =0--tags '

Next, we need to edit our environment variable configuration file

Cdvim. BASHRC

Will

SOURCE ~/.nvm/nvm.sh
Add into our. BASHRC, save exit.

Input command

SOURCE  . BASHRC
Add the new NVM to the system.

nvm-v# Viewing NVM versions

Two. Use NVM to install node first
NVM--help
To understand the specific use of NVM
NVM ls-remote
View the version of node you can use here I have selected v0.11.13, use the command to install it, and set it as the default version.
NVM Install 0.11.13NVM alias default 0.11.13
Installing node is an automatic installation of the Npm,node package manage
Problems: Sometimes when we open a new shell, we will be prompted to find the command for node and NPM, but we installed it clearly? Let's take a look at our. BASHRC There are no such two sentences
Export nvm_dir= "/USERS/YOURUSERNAME/.NVM" [-S "$NVM _dir/nvm.sh"] &&. "$NVM _dir/nvm.sh"  # this loads NVM
If not, add it yourself and use
source. BASHRC
To introduce the system.
Three. Use of NPM package management tools. I didn't know how to use it before, just know that NPM install when we use node, we will certainly use node's various packages, in order to facilitate management there is a NPM tool. Package.json is the directory for the node module, and the NPM install will be installed based on the JSON file. In our project, we use
NPM Init
To initialize our Package.json file, I used to copy it from another project, is it a melon? There are two cases when we need to install a new module. 1. Global Installation
NPM install-g PackageName
The parameter G shows that we are going to install to the global, so we can use 2. For a single engineering installation first go to the engineering root directory, and then we use
NPM Install PackageName--save

To install, plus--SAVE,NPM will help us to download the latest package and add the Package.json file.

Installation and use of Nvm,node and NPM under Ubuntu

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.