1. Execute npm install-g pm2
2.pm2 pm2 start app.js
pm2
3.ln -s /root/myapp/pm2 /usr/local/bin
still failed to solve the problem
messed up for a long time because no soft connection was created.
ln -s /root/node-v8.9.0-linux-x64/lib/node_modules/pm2/bin/pm2 /usr/local/bin
:ln: failed to create symbolic link "/usr/local/bin/pm2" : File exists
:mv /usr/local/bin/pm2 /tmp/ OK