The following worked for me to upgrade Angular 13 project to Angular 14 (October 2022):
In your project directory, open the command prompt with Admin rights. Then run the following command:
ng update @angular/core@14 @angular/cli@14 --allow-dirty --force
This should show an output similar to the below (may be different based on your existing Angular version):
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 14.2.5 to perform the update.
√ Package successfully installed.
Repository is not clean. Update changes will be mixed with pre-existing changes.
Using package manager: npm
Collecting installed dependencies...
Found 23 dependencies.
Fetching dependency metadata from registry...
Updating package.json with dependency @angular-devkit/build-angular @ "14.2.5" (was "13.2.6")...
Updating package.json with dependency @angular/cli @ "14.2.5" (was "13.2.6")...
Updating package.json with dependency @angular/compiler-cli @ "14.2.5" (was "13.2.7")...
Updating package.json with dependency typescript @ "4.8.4" (was "4.5.5")...
Updating package.json with dependency @angular/animations @ "14.2.5" (was "13.2.7")...
Updating package.json with dependency @angular/common @ "14.2.5" (was "13.2.7")...
Updating package.json with dependency @angular/compiler @ "14.2.5" (was "13.2.7")...
Updating package.json with dependency @angular/core @ "14.2.5" (was "13.2.7")...
Updating package.json with dependency @angular/forms @ "14.2.5" (was "13.2.7")...
Updating package.json with dependency @angular/platform-browser @ "14.2.5" (was "13.2.7")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "14.2.5" (was "13.2.7")...
Updating package.json with dependency @angular/router @ "14.2.5" (was "13.2.7")...
UPDATE package.json (1068 bytes)
√ Packages successfully installed.
** Executing migrations of package '@angular/cli' **
> Remove 'defaultProject' option from workspace configuration.
The project to use will be determined from the current working directory.
UPDATE angular.json (3177 bytes)
Migration completed.
> Remove 'showCircularDependencies' option from browser and server builders.
Migration completed.
> Replace 'defaultCollection' option in workspace configuration with 'schematicCollections'.
Migration completed.
> Update Angular packages 'dependencies' and 'devDependencies' version prefix to '^' instead of '~'.
UPDATE package.json (1068 bytes)
√ Packages installed successfully.
Migration completed.
> Remove 'package.json' files from library projects secondary entrypoints.
Migration completed.
> Update TypeScript compilation target to 'ES2020'.
UPDATE tsconfig.json (863 bytes)
Migration completed.
** Executing migrations of package '@angular/core' **
> As of Angular version 13, `entryComponents` are no longer necessary.
Migration completed.
> In Angular version 14, the `pathMatch` property of `Routes` was updated to be a strict union of the two valid options: `'full'|'prefix'`.
`Routes` and `Route` variables need an explicit type so TypeScript does not infer the property as the looser `string`.
Migration completed.
> As of Angular version 14, Forms model classes accept a type parameter, and existing usages must be opted out to preserve backwards-compatibility.
Migration completed.
The following is my updated package.json file, after the upgrade:
{
"name": "custom-project-14",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^14.2.5",
"@angular/common": "^14.2.5",
"@angular/compiler": "^14.2.5",
"@angular/core": "^14.2.5",
"@angular/forms": "^14.2.5",
"@angular/platform-browser": "^14.2.5",
"@angular/platform-browser-dynamic": "^14.2.5",
"@angular/router": "^14.2.5",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.2.5",
"@angular/cli": "^14.2.5",
"@angular/compiler-cli": "^14.2.5",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.8.4"
}
}