nodejs常用命令

  1. 停node进程
ps -ef | grep node

显示: root 21608 1441 1 19:31 ? 00:00:00 node /
查看node的进程,然后kill -9 1441
kill -9 进程ID

  1. node后台运行
 Basic Examples:
    Start an app using all CPUs available + set a name :
    $ pm2 start app.js -i 0 --name "api"

    Restart the previous app launched, by name :
    $ pm2 restart api

    Stop the app :
    $ pm2 stop api

    Restart the app that is stopped :
    $ pm2 restart api

    Remove the app from the process list :
    $ pm2 delete api

    Kill daemon pm2 :
    pm2 kill

查看日志pm2 logs
重启应用pm2 restart appId
停止应用 pm2 stop app.js
重启应用pm2 restart appId

  1. 包名称前面需要加"./"
    var a = require('./somepackage')

你可能感兴趣的:(nodejs常用命令)