yum -y update
yum-y install gcc make gcc-c++ openssl-devel
cd /usr/local/src
wget https://nodejs.org/dist/v8.11.1/node-v8.11.1.tar.gz
tar xvzf node-v8.11.1.tar.gz
cd node-v8.11.1
mv node-v8.11.1 node
./configure--prefix=/usr/local/node
sudo make && make install
vim /etc/profile :最后加上
#set for nodejs
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
source /etc/profile
node -v
输出:8.11.1
更新npm
npm install npm -g
网友评论