Skip to content

Instantly share code, notes, and snippets.

@ramsunvtech
Created July 31, 2024 07:31
Show Gist options
  • Save ramsunvtech/571647d1fbdd84101a72354ef4b32a6d to your computer and use it in GitHub Desktop.
Save ramsunvtech/571647d1fbdd84101a72354ef4b32a6d to your computer and use it in GitHub Desktop.
Simple Way to Deploy Node App

Clone the Latest Code from GitHub

git clone --depth=1 <REPO_URL> appName
cd appName

To remove the lock file

rm -rf package-lock.json

Install NVM

Install Node 16 and install server packages.

nvm use 16 <or your version>
npm i --verbose

Switch Node 18 and install client packages.

nvm use 18

Install NPM

npm install -g pm2 nodemon

Install Server Node Modules.

pm2 start "npm run start script command" --name <appName>

Check the Log

pm2 log <appName> 
pm2 set pm2:log_date_format "YYYY-MM-DD HH:mm:ss Z"
pm2 monit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment