The version of GCC installed through Yum in CentOS 6 is 4.4.7, which will cause the compilation to fail when installing node. js with the release of the GCC version too low
warning:c++ compiler too old, need g++ 4.8 or clang++ 3.4 (cxx=g++)
In fact, not only is the GCC version too low, but it is also possible that the PY version is too low, or that Py cannot recognize the bz2 problem.
The best solution is to install node. js through NVM.
Install command (currently the latest version is 0.33.2, the latest version can be viewed here):
curl-o-https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
Restart the shell after installation to view the NVM version with the following command:
NVM--version
View all node versions
NVM ls-remote
may be slow due to too many versions, for example, when the latest stable version of node is v6.10.2, install it with the following command
NVM Install v6.10.2
View the installed node version
Node--version
NPM--version
Toggle Node Version
NVM use v6.10.2
Set this version as the default
default v6.10.2
That's it.
Installing node. js with NVM under CentOS 6