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