npx pm2 kill로 서버를 종료한 뒤 변경된 명령어를 사용해봅시다. &&를 사용해 여러 개의 명령어를 연달아 실행할 수 있습니다.

    콘솔

    $ npx pm2 kill && npm start

    결과

    [PM2] Applying action deleteProcessId on app [all](ids: [ 0 ])
    [PM2] [server](0) 
    [PM2] [v] All Applications Stopped
    [PM2] [v] PM2 Daemon Stopped
    
    > nodebird@0.0.1 start
    > cross-env NODE_ENV=production PORT=80 pm2 start server.js -i 0
    
    [PM2] Spawning PM2 daemon with pm2_home=C:\Users\it\.pm2
    [PM2] PM2 Successfully daemonized
    [PM2] Starting C:
    ode\15
    odebird\server.js in cluster_mode (0 instance)
    [PM2] Done.

    ▲ 그림 15-3 npm start 실행 화면

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.