nvm installed in the windows and the centos

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/bowei026/article/details/90548368

NVM (Node version manager) the name suggests is nodejs version management software, you can switch between versions nodejs, without unloading any version of nodejs

First, the windows installation nvm

nvm official website under the windows https://github.com/coreybutler/nvm-windows, download  https://github.com/coreybutler/nvm-windows/releases/download/1.1.7/nvm-setup.zip   , unzip after installation you can (if installed nvm command does not take effect, reboot the operating system).

Modified settings.txt
find the installation directory under the nvm edit the settings.txt file, at the end of file add the following two lines:
node_mirror: https://npm.taobao.org/mirrors/node/ 
npm_mirror: https://npm.taobao .org / mirrors / npm /

Open cmd command line, a command is executed:
NVM List View the current version installed on your computer which nodejs
nvm list available to see newer versions of some of nodejs be installed more versions please visit https://nodejs.org/download/release /
NVM the install [version] nodejs a version installed, such as the install 12.3.0 NVM
NVM use 12.3.0
Node -v
NPM -v
NVM 10.15.3 the install
NVM use 10.15.3

We will modify environment variables after use nvm use command node and npm version of the switch, even after rebooting the system will not change. Reuse nvm use can change the node version

Second, the installation nvm centos

https://github.com/creationix/nvm
wget https://github.com/nvm-sh/nvm/archive/v0.34.0.tar.gz
tar -zxvf v0.34.0.tar.gz
cd NVM-0.34. 0
the ./install.sh
VI ~ / .bash_profile added at the end:
NVM_NODEJS_ORG_MIRROR = HTTPS: //npm.taobao.org/mirrors/node
Export NVM_NODEJS_ORG_MIRROR

source ~/.bash_profile
nvm --version

nvm ls-remote are listed in chronological order all the installed version nodejs
NVM install v10.15.3
NVM LS (can nvm list) to view the current version installed on your computer which nodejs
nvm v10.15.3 switching versions use
NVM Alias default settings v10.15.3 The default version

[root@localhost ~]# nvm --version
0.34.0
[root@localhost ~]# node -v
v10.15.3
[root@localhost ~]# npm -v
6.4.1

centos6如果要使用更高版本的nodejs,需要升级相应的依赖包,否则会报错,比如:
[root@localhost ~]# nvm use  v12.3.1
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by node)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `nvm use --delete-prefix v12.3.1` to unset it.

If centos7, you can directly install the latest version nodejs
NVM install v12.3.1
[root @ localhost NVM-0.34.0] # NVM --version
0.34.0
[root @ localhost NVM-0.34.0] # the Node -v
V12. 3.1
[root @ localhost NVM-0.34.0] # npm -v
6.9.0

If you hold down centos node version requires nvm alias default command, or quit the command line after the node version expired, the need to re-use nvm use or nvm alias default command to make node to take effect

This concludes this article, it may be more concerned about the number of public and personal micro signal:

Guess you like

Origin blog.csdn.net/bowei026/article/details/90548368