Linux Installation NVM
curl-o-https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | Bash
Or
wget-qo-https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | Bash
And then
SOURCE ~/.BASHRC
Installing node
NVM Install stable #安装最新稳定版
OK Extra Notes
NVM Install stable #安装最新稳定版 node
NVM Install 4.2.2 #安装 version 4.2.2
NVM install 0.12.7 #安装 version 0.12.7 Special Note: The following module installation is for demonstration purposes only, not the need to install modules
NVM use 0 #切换至 0.12.7
npm install-g Mz-fis #安装 Mz-fis module to the global catalog, and the path to the installation is/users/< your username >/.nvm/versions/node/v0. 12.7/lib/mz-fis
NVM use 4 #切换至 4.2.2
npm install-g react-native-cli #安装 react-native-cli module to the global catalog, the path to completion is/use rs/< your username >/.nvm/versions/node/v4.2.2/lib/react-native-cli
NVM alias default 0.12.7 #设置默认 node version for 0.12.7 NVM Toggle Version
If your default node version (set by the NVM alias command) differs from the version required for your project, you can create a. nvmrc file in the project root directory or any of its parent directories, specifying the node version number used in the file, for example:
CD < project root > #进入项目根目录
echo 4 >. NVMRC #添加. nvmrc file
nvm use #无需指定版本号, the version configured in the. nvmrc file is automatically used
node-v #查看 node is switched to the corresponding version