1、在博客根目錄下加以下jsnpm
//run const { exec } = require('child_process') exec('hexo server -p 80 & ',(error, stdout, stderr) => { if(error){ console.log('exec error: ${error}') return } console.log('stdout: ${stdout}'); console.log('stderr: ${stderr}'); })
2、安裝pm2 npm install -g pm2hexo
3、啓動博客 pm2 start hexo_run.jsui