소소한 개발/Tools
PM2를 이용하여 Next.js(Node.js) 시작하기
myungmin
2022. 2. 8. 14:45
PM2 란?
- PM2는 애플리케이션을 온라인으로 관리하고 유지하는 데 도움이 되는 데몬 프로세스 관리자 이다.
설치
- 최신 PM2 버전은 NPM 또는 Yarn으로 설치할 수 있다.
$ npm install pm2@latest -g
# or
$ yarn global add pm2
앱 시작
pm2 start [npm | yarn] --name [name][script]
# for development
pm2 start npm --name "next" -- run dev
# for production
npm run build
pm2 start npm --name "next" -- start
리눅스나 Mac은 POSIX라는 같은 스펙으로 돌아가기 때문에 문제가 없지만 Windows는 문제가 있다.
방법 1.
PM2를 Windows에서 사용할 때 문제를 회피하는 방법
방법 2.
https://naitas.tistory.com/entry/NodeJS-PM2-Startup-on-Windows
반응형