My Node app ran fine on my laptop. Getting it to run on a real server took 3 commands. Keeping it running took one more tool.
This post is part of my series on deploying a Node.js app to AWS. By now I have an Ubuntu EC2 instance, Node.js 22 and Git installed, and my project cloned from GitHub. If you're not there yet, the earlier steps are linked at the end.
1. Find the project folder
SSH into the server and list what's in your home folder:
ls
Enter fullscreen mode
Exit fullscreen mode
My project is called node-api . Move into it:
cd node-api
Enter fullscreen mode
Exit fullscreen mode
2. Install the dependencies
The node_modules folder is never in Git, so the server doesn't have it yet. Install it:
npm i
Enter fullscreen mode
Exit fullscreen mode
If this fails, check your Node version first with node -v . An old Node version is the most common cause. I'm on Node 22.
3. Start the app
npm start
Enter fullscreen mode
Exit fullscreen mode
My app prints that it's listening on port 4000.…