1.执行命令:
wget https://nodejs.org/dist/v8.1.0/node-v8.1.0-linux-x86.tar.gz
下载node包
2.解压
tar -zvxf node-v8.1.0-linux-x86.tar.gz
3.
mv node-v8.1.0-linux-x86 /usr/local/node-v8.1.0
[[email protected] ~]$ ls /usr/local/node-v8.1.0
bin CHANGELOG.md include lib LICENSE README.md share
[[email protected] ~]$ sudo ln -s /usr/local/node-v8.1.0/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
[[email protected] ~]$ sudo ln -s /usr/local/node-v8.1.0/bin/node /usr/local/bin/node
[[email protected] ~]$ sudo vim /etc/profile
添加:
export PATH=$PATH:/usr/local/node-v8.1.0/bin
[[email protected] ~]$ source /etc/profile
查看是否安装成功:
[[email protected] ~]$ node -v
-bash: /usr/local/bin/node: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
出现上面的错误,需要执行:
[[email protected] ~]$ yum whatprovides libstdc++.so.6
然后执行:
[[email protected] ~]$ sudo yum install libstdc++-4.4.7-23.el6.i686
查看:
[[email protected] ~]$ node -v
v8.1.0
[[email protected] ~]$ npm -v
5.0.3