Skip to content

bug(cdk/schematics): Cannot find module '@angular-devkit/core/src/workspace/json/reader' #27344

Closed
@michaelfaith

Description

@michaelfaith

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

16.0.3

Description

It appears that the release of 16.1 has resurrected the behavior @Splaktar reported in #21045. The other bug was locked, so I wasn't able to reply there. It seemed the suggestion from @alan-agius4 was to install @angular-devkit/core in order to ensure you have the right version, but we're already doing that, and it's still presenting. This all worked well in 16.0.3. Looking at my yarn.lock there's only the one version of @angular-devkit/core installed. Additionally, using any of the functions from @angular/cdk/schematics fail with a similar error.

Edit: based on @alan-agius4's comments below, it seems this is caused by @angular/cdk using deep imports in the schematics code, which is no longer allowed. This tracks with my findings, as cdk 16.1.1 will work if I rollback the cli libraries to 16.0.3.

Reproduction

ng generate @angular/material:mdc-migration

Expected Behavior

Migration completes successfully

Actual Behavior

When running the migration from the cli

Error: Cannot find module '@angular-devkit/core/src/workspace/json/reader' from '../../node_modules/@angular/cdk/schematics/utils/project-tsconfig-paths.js'

Require stack:
  D:/src/fabric/node_modules/@angular/cdk/schematics/utils/project-tsconfig-paths.js
  D:/src/fabric/node_modules/@angular/cdk/schematics/utils/index.js
  D:/src/fabric/node_modules/@angular/cdk/schematics/index.js
  D:/src/fabric/node_modules/@angular/material/schematics/ng-generate/mdc-migration/index_bundled.js

When using any functions from @angular/cdk/schematics

 Cannot find module '@angular-devkit/core/src/workspace/json/reader' from '../../node_modules/@angular/cdk/schematics/utils/project-tsconfig-paths.js'

    Require stack:
      D:/src/fabric/node_modules/@angular/cdk/schematics/utils/project-tsconfig-paths.js
      D:/src/fabric/node_modules/@angular/cdk/schematics/utils/index.js
      D:/src/fabric/node_modules/@angular/cdk/schematics/index.js
      schematics/ng-add/index.spec.ts

Environment

  • Angular: 16.0.3
  • CDK/Material: 16.1.1
  • Angular CLI: 16.1.1

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaroundarea: cdk/schematicscdk/schematics is *not* a public API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions