How to Deploy an Angular App for Free
Angular is a little harder to host than other frameworks. The output folder changed in Angular 17, and each Angular version needs a specific Node.js version. This guide shows how to deploy an Angular app for free on LaunchPad, which handles both for you.
What you need
- An Angular project in a GitHub or GitLab repository.
- A free Hostmargin account.
- A build that works locally:
npm installthennpm run build.
Step 1: Check your build script
Your package.json should have a build script that runs ng build:
"scripts": {
"build": "ng build"
}
Recent Angular versions build for production by default. On older versions, use ng build --configuration production.
Step 2: Create the project
- Sign in at launchpad.hostmargin.com and click New project.
- Choose GitHub or GitLab, paste the repository URL and pick the branch.
- Choose the Angular preset. It sets the build command to
npm run buildand the output directory todist.
Step 3: Let LaunchPad find the output folder
Angular doesn't write the site straight into dist:
| Angular version | Where the site is written |
|---|---|
| 17 and newer | dist/<project-name>/browser |
| 16 and older | dist/<project-name> |
You don't need to type these. With the Angular preset, LaunchPad reads angular.json during the build and publishes the real folder. The build log shows which one it used. Leave the output directory as dist.
Step 4: The right Node version, automatically
LaunchPad matches Node.js to your Angular version:
- Angular 12–13: Node 16
- Angular 14–17: Node 18
- Angular 18 and newer: Node 20
If your package.json sets engines.node, that wins.
Step 5: Deploy
Pick a free subdomain and click Create & Deploy. Angular installs take a little longer than most frameworks; the live log shows each step. When it says Live, your app is online with free SSL. Add the webhook from Settings to your repository and every push deploys automatically.
Common problems
Refreshing a route shows a 404
It won't on LaunchPad: unknown paths fall back to index.html, so Angular Router routes work on refresh and in shared links.
"Output directory not found"
Usually the output directory was changed to something specific that doesn't match angular.json. Set it back to dist and let LaunchPad read the real path.
Budget errors stop the build
Angular fails production builds that exceed the size budgets in angular.json. Reduce the bundle, or raise maximumError for the budget, then push again.
The install fails with peer dependency errors
This happens when package versions don't agree. Update the packages locally until npm install runs without --force, commit the new package-lock.json and push.
Next steps
- See the Angular section of the docs.
- Add a custom domain with free SSL from the Domains page.
- Questions? Read the FAQ.