Pm2 next js start

July 14, 2021 . 1 MIN READ

https://dev.to/reactstockholm/setup-a-next-js-project-with-pm2-nginx-and-yarn-on-ubuntu-18-04-22c9

 

 

Deploying a NextJS App in Production with PM2

Posted On : May 27, 2019 Published By : Aneh Thakur

In this tip I will explain how we can deploy our Next.js Application in Production mode and also run that Application with PM2. If you don’t know about Next.js then in simple word it was client side framework like Angular or ember etc. But most important thing it have server side render support, Stay connect I am going to publish some more tutorial over Next.js soon.

Step 1. Open you package.json file and replace scripts with below code

“scripts”: {    “dev”: “node server.js”,    “build”: “next build”,    “start”: “NODE_ENV=production node server.js”  },

Step 2. Create your production build using below

npm run build

Step 3. Now once your build complete successfully run below command to run your Next.js with PM2

pm2 start npm –name “my_app_name” — start

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *