Next.js: how can I use next in pm2?

Created on 27 Oct 2016  路  8Comments  路  Source: vercel/next.js

Most helpful comment

# for development
pm2 start npm --name "next" -- run dev

# for production
npm run build
pm2 start npm --name "next" -- start

All 8 comments

Duplicate of #83

I think it's not duplicate if it's about https://github.com/Unitech/pm2 ?

Good catch @nkzawa, must have read too quickly. Sorry @ckken!

Maybe Unitech/pm2#1317

# for development
pm2 start npm --name "next" -- run dev

# for production
npm run build
pm2 start npm --name "next" -- start

@nodegin thanks!

The above method is wrong on my computer (win7). I don't know why.

Now my solution is...

"scripts": {
    "pm2-next": "next build && pm2 start ./node_modules/next/dist/bin/next-start",
    "pm2-next-cluster": "next build && pm2 start ./node_modules/next/dist/bin/next-start -i max",
}

use: npm run pm2-next

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renatorib picture renatorib  路  3Comments

knipferrc picture knipferrc  路  3Comments

lixiaoyan picture lixiaoyan  路  3Comments

DvirSh picture DvirSh  路  3Comments

olifante picture olifante  路  3Comments