安装 node
部分需要先安装python,才能安装nodejs (可以先不安试一试)
yum install python2
ln -s /usr/bin/python2.7 /usr/bin/python
配置版本 node 12
curl --silent --location https://rpm.nodesource.com/setup_12.x | bash -
安装 nodejs
yum install -y nodejs
配置淘宝镜像
npm config set registry https://registry.npm.taobao.org
配置安装目录缓存目录(也可不配置),自定义目录
npm config set prefix "/opt/nodejs/node_global"
npm config set cache "/opt/nodejs/node_cache"
使用PM2
npm install pm2@latest -g
yum install pm2
安装 node 服务器支持
yum install express 或 koa