Cannot find module '@angular/cdk/./schematics/migration.json' when updating @angular/material
Description
Hello guys, when I am trying to upgrade my Angular 10 project to Angular 10.
I successfully updated the core and cli packages with:
ng update @angular/core @angular/cli
After trying to update the material package, which updates the cdk package as well, I get the following error:
ng update @angular/material

The @angular/cdk folder inside node_modules contains the schematics folder and the migration.json file inside of it, so it seems that the problem might be coming from that extra "./" and the path becomes incorrect.
Can you advise on how I can fix this error, so the necessary migrations are executed successfully and the ng update passes?
@tachojelev, can you please provide the full content of the log file and also the output of npm ls @angular/cdk?
I did try to replicate this locally on a version 10 project but I wasn't able to reproduce the reported issue.
update-ten git:(master) ng update @angular/material
Using package manager: 'npm'
Collecting installed dependencies...
Found 31 dependencies.
Fetching dependency metadata from registry...
Updating package.json with dependency @angular/cdk @ "11.0.3" (was "10.2.7")...
Updating package.json with dependency @angular/material @ "11.0.3" (was "10.2.7")...
UPDATE package.json (1319 bytes)
✔ Packages installed successfully.
** Executing migrations of package '@angular/cdk' **
❯ Updates the Angular CDK to v11.
✓ Updated Angular CDK to version 11
Migration completed.
** Executing migrations of package '@angular/material' **
❯ Updates Angular Material to v11.
⚠ General notice: The HammerJS v9 migration for Angular Components is not able to migrate tests. Please manually clean up tests in your project if they rely on HammerJS.
Read more about migrating tests: https://git.io/ng-material-v9-hammer-migrate-tests
✓ Updated Angular Material to version 11
Migration completed.
Hi @alan-agius4
Executing npm ls @angular/cdk displays the following:
└── UNMET DEPENDENCY @angular/[email protected]
npm ERR! missing: @angular/[email protected], required by [email protected]
After the ng update command, the cdk is indeed missing:

Log:
[error] Error: Cannot find module '@angular/cdk/./schematics/migration.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.resolve (internal/modules/cjs/helpers.js:33:19)
at UpdateCommand.run (<path-to-my-project>/node_modules/@angular/cli/commands/update-impl.js:493:25)
at process._tickCallback (internal/process/next_tick.js:68:7)
As an alternative, can I expect that manually editing the cdk and material versions in the package.json, making an npm install and then doing:
ng update @angular/cdk --migrate-only --from 10 --to 11
ng update @angular/material --migrate-only --from 10 --to 11
is the same as:
ng update @angular/cdk
ng update @angular/material
?
Yeah it’s the same. Although it is strange that @angular/cdk is not being installed.
Maybe you can also try to remove the lock file.
@alan-agius4 I tried the approach with removing the lock file and the update does not get performed at all
Package '@angular/material' is already up to date.
I will try using the alternative approach with the manual migration.
@alan-agius4 I tried the approach with removing the lock file and the update does not get performed at all
Package '@angular/material' is already up to date.I will try using the alternative approach with the manual migration.
That probably because either you didn’t revert the package.json or didn’t run npm install after the failed migration.
The easiest way forward would be to run the migration with —-migrate-only at this point.
@tachojelev, did you solve the issue?
Closing a there was no further communication. If the problem persists feel free to open a new issue.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.