上QQ阅读APP看书,第一时间看更新
How to do it...
- Open your command-line application.
- Clone the nvm project into a directory in your home folder:
git clone https://github.com/creationix/nvm.git ~/.nvm
- Add the following code to the bottom of your ~/.bashrc or ~/.zshrc file. If you don't know what shell you are running, it is probably bash and you should add the entry to ~/.bashrc:
# Configure NVM export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
- Save the file and return to your command line:
source ~/.bashrc # (or ~/.zshrc if you're running zshell)
- Confirm your installation by checking the version number of nvm:
> nvm --version
0.33.5
- List all of the node versions available for installation:
> nvm list-remote
- Install the latest Long Term Support (LTS) or stable version. (At the time of writing, version 8.9.4 is the latest LTS version):
> nvm install 8.9.4
- Confirm the installation of node and npm by checking their version numbers:
> node --version v8.9.4 > npm --version
5.6.0