angular-update-guide
angular-update-guide copied to clipboard
Updater cannot find tsconfig.json when migrating from v13 to v14
$ ng update @angular/core@14 @angular/cli@14
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 14.1.2 to perform the update.
✔ Package successfully installed.
DEPRECATED: The 'defaultProject' workspace option has been deprecated. The project to use will be determined from the current working directory.
Using package manager: npm
Collecting installed dependencies...
Found 48 dependencies.
Fetching dependency metadata from registry...
Updating package.json with dependency @angular/cli @ "14.1.2" (was "13.3.9")...
Updating package.json with dependency ng-packagr @ "14.1.0" (was "13.3.1")...
Updating package.json with dependency @angular-devkit/build-angular @ "14.1.2" (was "13.3.9")...
Updating package.json with dependency @angular/animations @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/common @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/compiler @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/compiler-cli @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/core @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/forms @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/platform-browser @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/platform-server @ "14.1.2" (was "13.3.11")...
Updating package.json with dependency @angular/router @ "14.1.2" (was "13.3.11")...
UPDATE package.json (2067 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 (9140 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 '~'.
✔ Packages installed successfully.
Migration completed.
▸ Remove 'package.json' files from library projects secondary entrypoints.
Migration completed.
▸ Update TypeScript compilation target to 'ES2020'.
✖ Migration failed: Path "/tsconfig.json" does not exist.
See "/tmp/ng-wfvrOj/angular-errors.log" for further details.
Content of /tmp/ng-wfvrOj/angular-errors.log:
[error] Error: Path "/tsconfig.json" does not exist.
at HostTree.readText (/tmp/angular-cli-packages-52RjBJ/node_modules/@angular-devkit/schematics/src/tree/host-tree.js:216:19)
at new JSONFile (/path/to/project/node_modules/@schematics/angular/utility/json-file.js:23:34)
at //path/to/project/node_modules/@schematics/angular/migrations/update-14/update-tsconfig-target.js:48:26
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I was executing the migration in the top-level of my project (where node_modules lives). The tsconfig is in ./src/tsconfig.json. I believe even if I executed the migration in the src directory, that command would fail. You’re looking for the file on the file system root. I believe the path should be ./tsconfig.json (note the leading dot).
It would be nice if I could restart the migration after the failing step (which I did manually).
For others who failed at that step, too, here are the missing migrations:
** 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.