I used vue-cli in
vue init nuxt/express myProject
and,
npm run dev
developed.
but,
npm run build
after, was created dist file.
How i can run in real service in pm2?
(I will use ubuntu in AWS EC.)
I used vue-cli in
vue init nuxt/express myProject
and,
npm run dev
developed.
but,
npm run build
after, was created dist file.
How i can run in real service in pm2?
(I will use ubuntu in AWS EC.)
you just need to start your app like that:
pm2 start npm --name "your-project-name" -- start
Check the status:
pm2 status
and after you can restart / stop:
pm2 restart your-project-name
pm2 stop your-project-name
Build/main.js
and .nuxt/dist
? –
Bromberg Prerequisites
Then
Add to your universal Nuxt app for serving it though PM2 is a file called ecosystem.config.js. Create a new file with that name in your root project directory and add the following content:
module.exports = {
apps: [
{
name: 'project-name',
exec_mode: 'cluster',
instances: 'max', // Or a number of instances
script: './node_modules/nuxt/bin/nuxt.js',
args: 'start'
}
]
}
Connect to your linux server via FTP (FileZilla or etc..) Send the blue files I marked to the server. (you don't need to upload node_modues, .nuxt, dist, .git, .idea, etc... folders)
Connect server via ssh console, (windows : putty) and go to projects folder that you uploaded files.
cd /
cd var/www/project-name
Install node_modules folder by;
npm install
Execute nuxt build and create .nuxt folder by;
npm run build
Finally, ready to start starts pm2 server by;
pm2 start
© 2022 - 2024 — McMap. All rights reserved.
Nuxt / express
Npm Do you need to target the folder created after run build? – Bromberg