运行pm2启动应用的时候,报下面这个错误
[PM2] Spawning PM2 daemon with pm2_home=/home/sufubo/.pm2
查看log
/usr/lib/node_modules/pm2/node_modules/chokidar/index.js:151
async remove(item) {
^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/Watcher.js:6:16)
原来是pm2版本过高,因为我的nodejs才是v6.17.1版本。
解决办法,安装低版本pm2解决
npm i pm2@3.5.1 -g