Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after updated to version 9 #36060

Closed
clement911 opened this issue Mar 13, 2020 · 70 comments
Closed

Error after updated to version 9 #36060

clement911 opened this issue Mar 13, 2020 · 70 comments
Milestone

Comments

@clement911
Copy link

Trying to update to version 9.

Cryptic errors and massive headache as usual 😱.

I'm stuck on this one:

ERROR in node_modules/@angular/common/http/http.d.ts:2801:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/common/http) which declares HttpClientModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

What does it mean?

@clement911
Copy link
Author

Setting "enableIvy": false in tsconfig.json does fix that particular error.
Isn't Ivy supposed to be usable already?

@petebacondarwin
Copy link
Contributor

Are there no other errors?

@clement911
Copy link
Author

The same error repeats multiple time.
Note that we did update material to 9.1.2 as part of the update instructions already.

ERROR in node_modules/@angular/common/http/http.d.ts:2801:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/common/http) which declares HttpClientModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

2801 export declare class HttpClientModule {
                          ~~~~~~~~~~~~~~~~
node_modules/mydatepicker/dist/my-date-picker.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (mydatepicker) which declares MyDatePickerModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

1 export declare class MyDatePickerModule {
                       ~~~~~~~~~~~~~~~~~~
node_modules/@angular/platform-browser/animations/animations.d.ts:37:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/platform-browser/animations) which declares BrowserAnimationsModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

37 export declare class BrowserAnimationsModule {
                        ~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@angular/material/dialog/dialog-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/dialog) which declares MatDialogModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatDialogModule {
                       ~~~~~~~~~~~~~~~
node_modules/@angular/material/input/input-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/input) which declares MatInputModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatInputModule {
                       ~~~~~~~~~~~~~~
node_modules/@angular/material/select/select-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/select) which declares MatSelectModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatSelectModule {
                       ~~~~~~~~~~~~~~~
node_modules/@angular/material/checkbox/checkbox-module.d.ts:11:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/checkbox) which declares MatCheckboxModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

11 export declare class MatCheckboxModule {
                        ~~~~~~~~~~~~~~~~~
node_modules/@angular/material/form-field/form-field-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/form-field) which declares MatFormFieldModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatFormFieldModule {
                       ~~~~~~~~~~~~~~~~~~
node_modules/@angular/material/snack-bar/snack-bar-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/snack-bar) which declares MatSnackBarModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatSnackBarModule {
                       ~~~~~~~~~~~~~~~~~
node_modules/@angular/material/icon/icon-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/icon) which declares MatIconModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatIconModule {
                       ~~~~~~~~~~~~~
node_modules/@angular/material/tree/tree-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/tree) which declares MatTreeModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatTreeModule {
                       ~~~~~~~~~~~~~
node_modules/@angular/material/tooltip/tooltip-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/tooltip) which declares MatTooltipModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatTooltipModule {
                       ~~~~~~~~~~~~~~~~
node_modules/@angular/material/slider/slider-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/material/slider) which declares MatSliderModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class MatSliderModule {
                       ~~~~~~~~~~~~~~~

@petebacondarwin
Copy link
Contributor

Can you post all of the versions of Angular packages that are installed, please.

@clement911
Copy link
Author

"dependencies":
{
"@angular/animations": "^9.0.6",
"@angular/cdk": "^9.1.2",
"@angular/common": "^9.0.6",
"@angular/compiler": "^9.0.6",
"@angular/core": "^9.0.6",
"@angular/forms": "^9.0.6",
"@angular/material": "^9.1.2",
"@angular/platform-browser": "^9.0.6",
"@angular/platform-browser-dynamic": "^9.0.6",
"@angular/router": "^9.0.6",
"@ngx-loading-bar/core": "^4.2.0",
"bootstrap": "^4.4.1",
"c3": "^0.5.4",
"core-js": "^2.4.1",
"file-saver": "^1.3.8",
"interact.js": "^1.2.8",
"jquery": "^3.4.1",
"mydatepicker": "2.6.9",
"ngx-chips": "2.1.0",
"popper.js": "^1.16.0",
"rxjs": "^6.5.4",
"select2": "3.5.1",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.6",
"@angular/cli": "^9.0.6",
"@angular/compiler-cli": "^9.0.6",
"@angular/language-service": "^9.0.6",
"@types/c3": "^0.7.3",
"@types/file-saver": "^1.3.0",
"@types/google.analytics": "^0.0.39",
"@types/interact.js": "^1.0.22",
"@types/jquery": "^2.0.49",
"@types/node": "^12.11.1",
"@types/select2": "^4.0.34",
"codelyzer": "^5.1.2",
"tslint": "~5.19.0",
"typescript": "~3.7.5"
}

@destus90
Copy link
Contributor

This topic has been discussed lots of times...
npm ci should help you.

@clement911
Copy link
Author

Was it documented anywhere? I dont see anything in the ng 9 migration instructions

@ngbot ngbot bot added this to the needsTriage milestone Mar 13, 2020
@destus90
Copy link
Contributor

@clement911
Not sure. More information can be found here #35399 and here #35480 (comment)

@clement911
Copy link
Author

npm cache clean --force didn't help.
What do we do now ?

Is it recommended/safe to run npm ci?

@clement911
Copy link
Author

Deleting node_modules and running npm install still results in the same error.

@amirensit
Copy link

Same problem for me.

@JoostK
Copy link
Member

JoostK commented Mar 15, 2020

For everyone experiencing this issue even after deleting node_modules, what does your build process look like? If you're using Angular CLI then it should work out of the box, but if you're using a custom build pipeline then you'd have to ensure that the node_modules tree is prepared for the usage with Ivy using ngcc. Please refer to the docs for more info on ngcc.

For folks that are using the CLI, would someone be able to share details or ideally a reproduction so that we can investigate?

@clement911
Copy link
Author

We use Angular CLI.
No custom build pipeling, precisely because we wanted to avoid this kind of cryptic errors and upgrade pains...

@JoostK
Copy link
Member

JoostK commented Mar 16, 2020

@clement911 Oh, I see. That makes it a bit tricky to figure out why this wouldn't work, as it should all be wired up to work (especially for @angular packages).

Is there any chance you can give more insight into your project? Can you share the full build output of a clean compilation, after removing the full node_modules tree? That would give a lot more insight into what steps are performed which may hopefully help in finding the culprit.

I'm sorry about your upgrade experience being poor!

@clement911
Copy link
Author

Thanks @JoostK
Here is the output of a clean build with no node_modules folder.
https://gist.github.com/clement911/a6134aa11aea616625e64a4395846f9a

Any ideas?

Also, I tried to build a minimal repro and I could get the issue to reproduce on a very minimal project.
But before sharing it, I removed node_modules again and ran npm install again. The error went away.
That is not the case with my full project though.

@JoostK
Copy link
Member

JoostK commented Mar 16, 2020

Oh, it being on Windows may be of relevance here. I have a suspicion of a caching issue, where the processed .d.ts files would maybe not be evicted in the CLI's file cache, perhaps because of file path issues.

@JoostK
Copy link
Member

JoostK commented Mar 16, 2020

Although, that can't be the case if the issue persists across CLI builds 🤔

@clement911
Copy link
Author

I'm attempting to prepare a minimal repro.

@JoostK
Copy link
Member

JoostK commented Mar 16, 2020

Alternatively, could you archive the node_modules/@angular/common folder as that might also give some insights.

@clement911
Copy link
Author

Here is the minimal-ish repro: https://github.com/clement911/ng9-error
Simply download the project, run npm install then ng build and observe the error (hopefully).

Regarding your last comment, I'm not sure what you mean by 'archive'?

@JoostK
Copy link
Member

JoostK commented Mar 16, 2020

Create a zip and share it somewhere ;)

@JoostK
Copy link
Member

JoostK commented Mar 16, 2020

@clement911 Bingo! I can reproduce (on OS X), although the initial ng build was successful. Looking into it.

@clement911
Copy link
Author

I simplified it further, in case it helps. It's quite minimal now...

@clement911
Copy link
Author

clement911 commented Mar 16, 2020

If I delete package-lock.json before running npm install I get a different error:

chunk {main} main.js, main.js.map (main) 608 bytes [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 663 bytes [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 525 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 149 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 67.8 kB [initial] [rendered]
Date: 2020-03-16T15:05:53.991Z - Hash: 7fb225da1dc76b9e2e40 - Time: 7322ms

ERROR in node_modules/@types/node/module.d.ts:57:14 - error TS2300: Duplicate identifier 'mod'.

57     export = Module;
                ~~~~~~

  node_modules/@types/requirejs/index.d.ts:38:11
    38  export = mod;
                 ~~~
    'mod' was also declared here.
node_modules/@types/requirejs/index.d.ts:38:11 - error TS2300: Duplicate identifier 'mod'.

38  export = mod;
             ~~~

  node_modules/@types/node/module.d.ts:57:14
    57     export = Module;
                    ~~~~~~
    'mod' was also declared here.
node_modules/@types/requirejs/index.d.ts:422:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'require' must be of type 'NodeRequire', but here has type 'Require'.

422 declare var require: Require;
                ~~~~~~~

  node_modules/@types/node/globals.d.ts:167:13
    167 declare var require: NodeRequire;
                    ~~~~~~~
    'require' was also declared here.

I updated @types/node to latest but that didn't help.

@jmartinez-transom
Copy link

I just had this issue when importing angular material radio. I just stopped the running console and try again with ng serve.

@JoostK
Copy link
Member

JoostK commented Mar 16, 2020

So the issue here is definitely with the src/node_modules directory. I have no idea why that thing is there, but it is considered as primary node_modules directory and this causes all ngcc's path computations to be off, leading to all sorts of issues with incorrect paths when writing compiled artifacts.

@clement911
Copy link
Author

oh really?
Yes we do have a src/node_modules that we use to export some classes that we use everywhere through out the project.
This allows to import these classes without using a relative path.
It is definitely valid in Typescript. See https://www.typescriptlang.org/docs/handbook/module-resolution.html#how-typescript-resolves-modules

@clement911
Copy link
Author

Also it works when we turn off ivy...

@akshayarise
Copy link

@petebacondarwin So I have to stop ng serve before installing or updating packages?

In my case removing node_modules and reinstalling them solve the issue

working for me as well.

@Mph1399
Copy link

Mph1399 commented Apr 4, 2020

I just had this issue when importing angular material radio. I just stopped the running console and try again with ng serve.

Same situation for me when importing material slider.

@AliYusuf95
Copy link

AliYusuf95 commented Apr 5, 2020

@petebacondarwin When I faced the issue I tried to restart several times and each time I got this error.

$ ng serve 
Compiling @angular/cdk/keycodes : module as esm5
Compiling @angular/cdk/platform : module as esm5
Error: Tried to write ...../node_modules/@angular/cdk/platform/platform.d.ts.__ivy_ngcc_bak with an ngcc back up file but it already exists so not writing, nor backing up, ...../node_modules/@angular/cdk/platform/platform.d.ts.
This error may be because two or more entry-points overlap and ngcc has been asked to process some files more than once.
You should check other entry-points in this package and set up a config to ignore any that you are not using.
Error: Tried to write ...../node_modules/@angular/cdk/platform/platform-module.d.ts.__ivy_ngcc_bak with an ngcc back up file but it already exists so not writing, nor backing up, ...../node_modules/@angular/cdk/platform/platform-module.d.ts.
This error may be because two or more entry-points overlap and ngcc has been asked to process some files more than once.
You should check other entry-points in this package and set up a config to ignore any that you are not using.
Error: Tried to write ...../node_modules/@angular/cdk/platform/index.d.ts.__ivy_ngcc_bak with an ngcc back up file but it already exists so not writing, nor backing up, ...../node_modules/@angular/cdk/platform/index.d.ts.
This error may be because two or more entry-points overlap and ngcc has been asked to process some files more than once.
You should check other entry-points in this package and set up a config to ignore any that you are not using.
Compiling @angular/cdk/collections : module as esm5
Compiling @angular/cdk/portal : module as esm5
Compiling @angular/common/http : module as esm5
Compiling @ngrx/store : module as esm5
Compiling @angular/core/testing : module as esm5
Compiling @angular/platform-browser/testing : module as esm5
Compiling @angular/router : module as esm5
Compiling @angular/material/form-field : module as esm5
Compiling @angular/cdk/scrolling : module as esm5
Compiling @angular/cdk/layout : module as esm5
Error: Failed to compile entry-point @angular/cdk/scrolling (module as esm5) due to compilation errors:
node_modules/@angular/cdk/platform/platform-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of ScrollingModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/cdk/platform) which declares PlatformModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class PlatformModule {
                       ~~~~~~~~~~~~~~

Warning: Skipping processing of @angular/cdk/overlay because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/select because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/dialog because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/tooltip because its dependency @angular/cdk/scrolling failed to compile.
Compiling @angular/compiler/testing : module as esm5
Compiling @angular/cdk/text-field : module as esm5
Error: Failed to compile entry-point @angular/cdk/text-field (module as esm5) due to compilation errors:
node_modules/@angular/cdk/platform/platform-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of TextFieldModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/cdk/platform) which declares PlatformModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class PlatformModule {
                       ~~~~~~~~~~~~~~

Warning: Skipping processing of @angular/material/input because its dependency @angular/cdk/text-field failed to compile.
Compiling @angular/material/button : module as esm5
Warning: Skipping processing of @angular/material/paginator because its dependency @angular/cdk/scrolling failed to compile.
Compiling @angular/material/icon : module as esm5
Compiling @ngrx/effects : module as esm5
Compiling ng-block-ui : module as esm5
Compiling @angular/cdk/accordion : module as esm5
Compiling @angular/material/divider : module as esm5
Compiling @angular/cdk/stepper : module as esm5
Compiling @angular/cdk/table : module as esm5
Compiling @angular/material/sort : module as esm5
Compiling @angular/common/testing : module as esm5
Compiling @angular/platform-browser-dynamic/testing : module as esm5
Compiling @angular/cdk/tree : module as esm5
Warning: Skipping processing of @angular/cdk/drag-drop because its dependency @angular/cdk/scrolling failed to compile.
Compiling @ngrx/router-store : module as esm5
Warning: Skipping processing of @angular/material/autocomplete because its dependency @angular/cdk/scrolling failed to compile.
Compiling ngx-window-token : module as esm5
Warning: Skipping processing of @angular/material/bottom-sheet because its dependency @angular/cdk/scrolling failed to compile.
Compiling @angular/platform-server : module as esm5
Compiling @angular/animations/browser/testing : module as esm5
Compiling @angular/cdk/clipboard : module as esm5
Compiling ngx-highlightjs : module as esm5
Warning: Skipping processing of @angular/material/datepicker because its dependency @angular/cdk/text-field failed to compile.
Compiling @angular/common/http/testing : module as esm5
Compiling @agm/core : module as esm5
Compiling @angular/material/card : module as esm5
Compiling @angular/material/badge : module as esm5
Warning: Skipping processing of @angular/material/menu because its dependency @angular/cdk/scrolling failed to compile.
Compiling @angular/material/button-toggle : module as esm5
Compiling @angular/material/checkbox : module as esm5
Compiling @angular/material/expansion : module as esm5
Warning: Skipping processing of @angular/material/sidenav because its dependency @angular/cdk/scrolling failed to compile.
Compiling @angular/material/grid-list : module as esm5
Compiling @angular/material/chips : module as esm5
Warning: Skipping processing of @angular/material/snack-bar because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/table because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/tabs because its dependency @angular/cdk/scrolling failed to compile.
Compiling @angular/material/icon/testing : module as esm5
Compiling @angular/material/radio : module as esm5
Compiling @angular/material/progress-bar : module as esm5
Compiling @angular/material/list : module as esm5
Compiling @angular/material/slide-toggle : module as esm5
Compiling @angular/material/slider : module as esm5
Compiling @angular/material/toolbar : module as esm5
Compiling @angular/material/stepper : module as esm5
Compiling @angular/platform-server/testing : module as esm5
Compiling @angular/material/tree : module as esm5
Compiling @angular/router/testing : module as esm5
Compiling @angular/material-moment-adapter : module as esm5
Compiling @ngrx/entity : module as esm5
Compiling @ngrx/effects/testing : module as esm5
Compiling @ng-bootstrap/ng-bootstrap : module as esm5
Compiling @ngrx/store/testing : module as esm5
Compiling @ngx-loading-bar/core : module as esm5
Compiling @ngrx/store-devtools : module as esm5
Compiling @nrwl/angular : module as esm5
Compiling angular-in-memory-web-api : module as esm5
Compiling @rxweb/reactive-form-validators : module as esm5
Compiling ng-block-ui/http : module as esm5
Compiling ng-block-ui/router : module as esm5
Compiling ngx-clipboard : module as esm5
Compiling ng-inline-svg : module as esm5
Compiling ngx-daterangepicker-material : module as esm5
Compiling ngx-highlightjs/plus : module as esm5
Compiling ngx-perfect-scrollbar : module as esm5
Compiling ngx-permissions : module as esm5
0% compiling
Compiling @angular/cdk/scrolling : module as esm5

chunk {main} main.js, main.js.map (main) 2.46 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 690 bytes [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 468 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 7.74 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 338 kB [initial] [rendered]
Date: 2020-04-02T07:17:12.873Z - Hash: 97a7e2c6a51c119e4be5 - Time: 8625ms

ERROR in Failed to compile entry-point @angular/cdk/scrolling (module as esm5) due to compilation errors:
node_modules/@angular/cdk/platform/platform-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of ScrollingModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/cdk/platform) which declares PlatformModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class PlatformModule {
                       ~~~~~~~~~~~~~~


I tried to build the project but it's the same thing.

$ nx build
Compiling @angular/cdk/text-field : module as esm5
Compiling @angular/cdk/scrolling : module as esm5
Error: Failed to compile entry-point @angular/cdk/text-field (module as esm5) due to compilation errors:
node_modules/@angular/cdk/platform/platform-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of TextFieldModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/cdk/platform) which declares PlatformModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class PlatformModule {
                       ~~~~~~~~~~~~~~

Warning: Skipping processing of @angular/material/input because its dependency @angular/cdk/text-field failed to compile.
Error: Failed to compile entry-point @angular/cdk/scrolling (module as esm5) due to compilation errors:
node_modules/@angular/cdk/platform/platform-module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of ScrollingModule, but could not be resolved to an NgModule class.

This likely means that the library (@angular/cdk/platform) which declares PlatformModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

8 export declare class PlatformModule {
                       ~~~~~~~~~~~~~~

Warning: Skipping processing of @angular/cdk/overlay because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/select because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/tooltip because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/dialog because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/paginator because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/cdk/drag-drop because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/autocomplete because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/bottom-sheet because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/datepicker because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/menu because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/sidenav because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/snack-bar because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/table because its dependency @angular/cdk/scrolling failed to compile.
Warning: Skipping processing of @angular/material/tabs because its dependency @angular/cdk/scrolling failed to compile.
Error: There are still unprocessed tasks in the queue and no tasks are currently in progress, yet the queue did not return any available tasks: ParallelTaskQueue
  All tasks completed: true
  Unprocessed tasks (0): 
  In-progress tasks (0): 
  Blocked tasks (0): 
    at ClusterMaster.maybeDistributeWork (...../node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:129:27)
    at ClusterMaster.onWorkerTaskCompleted (...../node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:197:18)
    at ClusterMaster.onWorkerMessage (...../node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:168:33)
    at ...../node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:50:95
    at ClusterMaster.<anonymous> (...../node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:246:57)
    at step (...../node_modules/tslib/tslib.js:139:27)
    at Object.next (...../node_modules/tslib/tslib.js:120:57)
    at ...../node_modules/tslib/tslib.js:113:75
    at new Promise (<anonymous>)
    at Object.__awaiter (...../node_modules/tslib/tslib.js:109:16)
An unhandled exception occurred: NGCC failed.
See "/private/var/folders/9t/6ttybf615csckrl72kbl7_bc0000gq/T/ng-ozlxcn/angular-errors.log" for further details.

That's why I had to clear node_modules to make it work.

@Akash491
Copy link

@ChelloApps - did you stop ng serve before adding the new package?

In my case stopping ng serve before adding the new package solved issue. Thanks a lot @petebacondarwin

@samivic
Copy link

samivic commented Apr 12, 2020

npm ci to delete node_modules and the npm install, it works for me. i had problem with Angular Materials!

@rdelormeCHS
Copy link

Hi, I have this issue as well on a new project i created a few days ago. I have a project I created about a month ago that does not have this problem. I notice some differences in behavior but cannot figure out the difference in environment or configuration that is pointing to the problem. I think if this can be identified it will help a lot to solving this issue since i have 2 projects in the same computer: one with the problem, one without. Both Angular 9 and relatively new.

The month old project. I can run ng serve and add material modules and it compiles them fine. Als, in the imports, the intellisense is resolving all installed modules and i can pick from the list and it auto-imports (VS Code).

The new project, none of that works: intellisense does not show the module unless the import is added first. There is no auto-import working. And, ng serve blows up with the Ivy error.

So if I can figure out the difference between these 2 projects, It will probably point to the issue! I am a fairly new to angular so a bit raw on all the configuration files. Is there anything I can post that would help more experienced eyes?

@mhmdtshref
Copy link

I got the same problem, I just noticed that I've imported MatDialog to my module instead of MatDialogModule! So ashamed about this!

@pubkey
Copy link

pubkey commented May 3, 2020

@mhartington Thank you so much. That was it. I feel stupid now :)

@mariohmol
Copy link

I got this in a brand new app ng new ..

  ERROR in node_modules/@angular/common/http/http.d.ts:2801:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
    
    This likely means that the library (@angular/common/http) which declares HttpClientModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
    
    2801 export declare class HttpClientModule {

@isakki
Copy link

isakki commented Jun 4, 2020

An unhandled exception occurred: NGCC failed.
See "/tmp/ng-uQq1Rv/angular-errors.log" for further details.

How to fix this issue ?

@petebacondarwin
Copy link
Contributor

@isakki - it is impossible to tell with so little information. Have you tried completely deleting the node_modules folder and re-installing?

@alejandro-juarez-ctx
Copy link

@mhmdtshref Good catch man, spent an hour troubleshooting that and the error got solved by actually importing the module. Who would have thought? 🙃 Thanks a lot!

@rostic54
Copy link

I started project through sudo yarn start and it was successfully and then stoped and again started without sudo and also ok.

@vinaykannambadi
Copy link

for me npm ci after re-installing packages compiled successfully.

@fazliraziq
Copy link

This topic has been discussed lots of times...
npm ci should help you.

Thank you!, npm ci command fixed it

No it doesnt in my case

@Sandeep-GitAcc
Copy link

Sandeep-GitAcc commented Aug 1, 2020

Any update on the issue? I am facing the same issue

ERROR in node_modules/@angular/material/tabs/tab-group.d.ts:141:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
    
    This likely means that the library (@angular/material/tabs) which declares MatTabGroup has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
    
    141 export declare class MatTabGroup extends _MatTabGroupBase {

I tried setting
"enableIvy": false
also
npm ci

I could import MatListModule but not MatTabGroup

@denizbayar
Copy link

I got the same problem, I just noticed that I've imported MatDialog to my module instead of MatDialogModule! So ashamed about this!

Ohhh man I had the same and couldn't solve it until I read this! :D

@Charles-Chiakwa
Copy link

Has anyone resolved this issue? All options above did not work for me

@Charles-Chiakwa
Copy link

This is my error:

esm5) due to compilation errors:
node_modules/@angular/material/fesm5/datepicker.js:2304:30 - error NG1010: Value at position 0 in the NgModule.exports of MatDatepickerModule is not a reference: [object Object]

2304                     exports: [
                                  ~
2305                         CdkScrollableModule,
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ...
2316                         MatCalendarHeader,
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2317                     ],
     ~~~~~~~~~~~~~~~~~~~~~```

@Charles-Chiakwa
Copy link

Charles-Chiakwa commented Aug 20, 2020

So I turned ivy to false in my tsconfig.app.json, it seems to have skipped the errors I had above, but when compilling I get a new error.
ERROR in Can't export value CdkScrollableModule in C:/Users/seamfix/base-angular-web-app/node_modules/@angular/cdk/scrolling/index.d.ts from MatSelectModule in C:/Users/seamfix/base-angular-web-app/node_modules/@angular/material/select/index.d.ts as it was neither declared nor imported!

@Charles-Chiakwa
Copy link

Charles-Chiakwa commented Aug 20, 2020

All these errors started when I upgraded to Angular 9. Am I using incompactible versions???
This is my package.json

  "name": "base-angular-web-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.1.4",
    "@angular/common": "~9.1.4",
    "@angular/compiler": "~9.1.4",
    "@angular/core": "^9.1.12",
    "@angular/forms": "~9.1.4",
    "@angular/localize": "^9.1.12",
    "@angular/material": "^9.2.4",
    "@angular/platform-browser": "~9.1.4",
    "@angular/platform-browser-dynamic": "~9.1.4",
    "@angular/router": "~9.1.4",
    "base-frontend": "^1.0.1-beta.40",
    "bootstrap": "^4.5.0",
    "intl-tel-input": "^17.0.3",
    "libphonenumber-js": "^1.7.56",
    "mkdirp": "^0.5.4",
    "ngx-bootstrap": "^5.6.1",
    "ngx-mat-intl-tel-input": "^3.1.0",
    "path-to-regexp": "^2.4.0",
    "quill": "^1.3.7",
    "rxjs": "~6.5.4",
    "sfx-form-builder": "^1.4.0-beta.18",
    "sfx-form-capture": "^1.7.2-beta.6",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.4",
    "@angular/cli": "~9.1.4",
    "@angular/compiler-cli": "~9.1.4",
    "@angular/language-service": "~9.1.4",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.12.54",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.3",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.8.3"
  }
}

@star-over
Copy link

star-over commented Sep 2, 2020

Has anyone resolved this issue? All options above did not work for me

Check TypeScript version
The Angular Compiler requires TypeScript >=3.9.2 and <4.0.0

@fireflysemantics
Copy link

I started having a similar issue. Asked about it here on SO:

https://stackoverflow.com/questions/63850751/angular-10-module-not-compiling

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests