Skip to content

NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class. #37256

Closed
@ahilangopal

Description

@ahilangopal

🐞 bug report

Affected Package

@ionic-native/file

I have tried all other @ionic-native plugin same error

Description

I am using ionic5 (Capacitor) with Angular9 , when I tried to use/declare File plugin I am getting below error. I have tried all other plugin same error. I also tried setting enableIvy: false. I got differnt error pointing to plugin

🔥 Exception or Error

ERROR in node_modules/@ionic-native/file/ngx/index.d.ts:570: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 (@ionic-native/file/ngx) which declares File 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.

570 export declare class File extends IonicNativePlugin {

Error once Ivy disabled

ERROR in Unexpected value 'File in C:/Projects/WebApp/node_modules/@ionic-native/file/ngx/index.d.ts' imported by the module 'InfoModule in C:/Projects/WebApp/apps/mobile/ionic-mobile/src/app/pages/info/info.module.ts'. Please add a @NgModule annotation.

🌍 Your Environment

Ionic:

Ionic CLI : 6.5.0
Ionic Framework : @ionic/angular 5.1.0
@angular-devkit/build-angular : 0.901.5
@angular-devkit/schematics : 9.1.1
@angular/cli : 9.1.1
@ionic/angular-toolkit : 2.2.0

Capacitor:

Capacitor CLI : 1.1.1
@capacitor/core : 1.1.1

Utility:

cordova-res (update available: 0.11.0) : 0.10.0
native-run : 1.0.0

System:

NodeJS : v12.16.1 (C:\Program Files\nodejs\node.exe)
npm : 6.13.4
OS : Windows 10

Angular Info
Angular CLI: 9.1.1
Node: 12.16.1
OS: win32 x64

Angular: 9.1.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes

Package Version
@angular-devkit/architect 0.803.26
@angular-devkit/build-angular 0.901.5
@angular-devkit/build-optimizer 0.901.5
@angular-devkit/build-webpack 0.901.5
@angular-devkit/core 9.1.1
@angular-devkit/schematics 9.1.1
@angular/cdk 9.2.3
@angular/cli 9.1.1
@angular/material 9.2.3
@ngtools/webpack 9.1.5
@schematics/angular 9.1.5
@schematics/update 0.901.1
rxjs 6.5.5
typescript 3.7.5
webpack 4.42.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerIssues related to `ngc`, Angular's template compiler

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions