a) 安装必要环境: yum install gcc gcc-c++
b) 进入安装目录: cd /usr/local
- c) wget
- d) tar -xvf node-v8.0.0-Linux-x64.tar.xz
- e) mv node-v8.1.4-Linux-x64 node
f) 配置环境: VIM /etc/profile
g) 在打开的文件尾部添加:
- #set for Node.JS
- export NODE_HOME=/usr/local/node (路径为 node 安装路径)
- export PATH=$NODE_HOME/bin:$PATH
H) 刷新配置, 使其生效: source /etc/profile
I) 检查安装是否成功:
node -v
NPM -v
J) 安装 cnpm 命令: NPM install -g cnpm --registry=https://registry.npm.taobao.org
安装 NPM
来源: http://www.bubuko.com/infodetail-3463914.html