Upgrading an Angular application to the latest version can be a daunting task, especially when dealing with dependencies like @arcgis/core
. In this blog post, we’ll walk you through the process of upgrading an Angular app from version 15 to 18, while ensuring compatibility and minimizing disruptions.
Why Upgrade?
Angular continuously evolves, introducing new features, performance improvements, and security patches. Upgrading to the latest version (Angular 19 as of February 2025) ensures our app remains modern, secure, and efficient.
Prerequisites
Before starting, ensure we have:
- A backup of our project.
- The latest stable version of Node.js and npm installed.
- Familiarity with Angular’s Update Guides.
Step-by-Step Upgrade Process
1. Upgrade to Angular 16
- Use
npx
to Update Angular CLI and Core:
To avoid global installation conflicts, use npx
to ensure the correct version of Angular CLI is used for the upgrade. For example, if we have a globally installed version of Angular CLI (e.g., version 19) and a local project using Angular 15, and we want to upgrade to Angular 16, let us follow these steps:
npx @angular/cli@16 update @angular/core@16 @angular/cli@16
- Install Dependencies:
After updating, let us install the necessary dependencies locally:
npm install
PS: After upgrading the application, please ensure to use npx
to run the application. If you do not use npx
, you may encounter issues because the globally installed Angular version may differ from the locally installed version.
npx npm run start
- Test the App:
Run unit tests and manually verify the app’s functionality.
2. Upgrade to Angular 17
3. Upgrade to Angular 18
The process for upgrading to Angular 17 and 18 is identical to the steps followed for upgrading to Angular 16. Below is a detailed guide to help you seamlessly transition to these newer versions.
- Update Angular CLI and Core
- Install Dependencies
- Test the Application