'Angular Migration Error for Version 13.0.3
I got the following issue while upgrading from Angular 12 to 13.0.3.
Using package manager: 'npm'
Collecting installed dependencies...
Found 79 dependencies.
Fetching dependency metadata from registry...
Updating package.json with dependency @angular-devkit/build-angular @ "13.0.3" (was "12.2.13")...
Updating package.json with dependency @angular/cli @ "13.0.3" (was "12.2.13")...
Updating package.json with dependency @angular/compiler-cli @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/language-service @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency typescript @ "4.4.4" (was "4.3.5")...
Updating package.json with dependency @angular/animations @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/common @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/compiler @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/core @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/forms @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/localize @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/platform-browser @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "13.0.2" (was "12.2.13")...
Updating package.json with dependency @angular/router @ "13.0.2" (was "12.2.13")...
UPDATE package.json (5301 bytes)
✔ Packages successfully installed.
** Executing migrations of package '@angular/cli' **
...
> Migrates `[routerLink]=""` in templates to `[routerLink]="[]"` because these links are likely intended to route to the current page with updated fragment/query params.
× Migration failed: Cannot read property 'readWorkspace' of undefined
See "C:\Users\BENEDI~1\AppData\Local\Temp\ng-0SNaUB\angular-errors.log" for further details.
The angular-errors.log content is simply this:
[error] TypeError: Cannot read property 'readWorkspace' of undefined
at C:\angular_upgrade\Nova\Avatar\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:117:59
at Generator.next (<anonymous>)
at C:\angular_upgrade\Nova\Avatar\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:14:71
at new Promise (<anonymous>)
at __awaiter (C:\angular_upgrade\Nova\Avatar\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:10:12)
at getWorkspace (C:\angular_upgrade\Nova\Avatar\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:115:16)
at C:\angular_upgrade\Nova\Avatar\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:40:37
at Generator.next (<anonymous>)
at C:\angular_upgrade\Nova\Avatar\node_modules\@angular\core\schematics\utils\project_tsconfig_paths.js:14:71
at new Promise (<anonymous>)
Has anyone encountered this and how do you fix it?
Rgds, Benedict
Solution 1:[1]
This should work after installing from npm using migrate-only.
ng update --migrate-only --from=12 --to=13 @angular/core
Solution 2:[2]
Try updating Angular 12 to Angular 13 like this below:
ng update @angular/core@12 @angular/cli@13 --force
Solution 3:[3]
try this!
npm i @angular-devkit/core@13 --save
Solution 4:[4]
For me the following steps helped:
- Go back to angular 12 version - reset your git back to where you were before the updated begun.
- Install package
angular-devkit/core. Because it exports that missing functionreadWorkspace.npm i angular-devkit/core --save-dev
- Repeat the upgrade
npx @angular/cli@13 update @angular/core@13 @angular/cli@13
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Priyanka Vadhwani |
| Solution 2 | Salahuddin Ahmed |
| Solution 3 | Jigna Rathod |
| Solution 4 |
