### 1. npm i 啟動項目
```
推送本地代碼到碼云,項目部署服務器公鑰,注意,不是個人設置的公鑰,是項目設置中的部署公鑰
cd /var/www/ // 進入www文件夾 (centos 默認在 /usr/share/nginx/html)
cd html // 進入 www 中 html 文件夾
mkdir /data // 新建 data 文件夾
cd /data // 進入
git clone git@gitee.com:MrXuxu/toLike.git // 拉取代碼
cd 到項目中,npm i 安裝項目
node index.js
```
> 出現 cb() never be called 等錯誤,升級 npm解決
1. 首先要以管理員模式打開cmd清除你的npm緩存 :?npm cache clean -f
2. 清除完緩存后,安裝最新版本的Node helper: npm install -g n?
如果錯誤,執行以下? ? npm install -g n --force
3. 告訴助手(n)安裝最新的穩定版Node:n stable
### 2. 安裝 PM2,在服務器部署
```
npm i -g pm2
pm2 start index.js // 啟動
```

```
pm2 logs index // 查看
curl http://localhost:3000/admin/ // 請求地址
```
### 3. pm2 需要在代碼更新后手動重新加
```
pm2 reload index.js
```