LeafletModule was unable to be identified as an NgModule class within the Ivy framework

Currently working on an angular project using ngx-leaflet. Upon initiating ng serve in the terminal, the following error message pops up:

Error: node_modules/@asymmetrik/ngx-leaflet/dist/leaflet/leaflet.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This issue indicates that the library (@asymmetrik/ngx-leaflet) that declares LeafletModule may not have been processed correctly by ngcc or is not compatible with Angular Ivy. Consider checking for a newer version of the library and updating if available. It might also be helpful to reach out to the developers of the library to confirm its compatibility with Ivy.

1 export declare class LeafletModule {
                       ~~~~~~~~~~~~~

The module is imported in the app.module.ts:

import { LeafletModule } from '@asymmetrik/ngx-leaflet';

And added to the @NgModule in app.module.ts:

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ReactiveFormsModule,
    AngularFireModule.initializeApp(config),
    AngularFireAnalyticsModule,
    AngularFirestoreModule,
    AngularFireAuthModule,
    AngularFireStorageModule,
    AngularFireDatabaseModule,
    BrowserModule,
    AppRoutingModule,
    LeafletModule
  ],
  providers: [
    ...
  ],
  bootstrap: [AppComponent]
})

Could this be a common issue, or am I possibly making an error with the import?

Version details:

Angular CLI: 11.0.6
Node: 12.18.3
OS: darwin x64

Angular: 10.0.8
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.6
@angular-devkit/build-angular   0.1100.6
@angular-devkit/core            11.0.6
@angular-devkit/schematics      11.0.6
@angular/cli                    11.0.6
@angular/fire                   6.0.2
@schematics/angular             11.0.6
@schematics/update              0.1100.6
rxjs                            6.5.5
typescript                      3.9.7

from package.json:

"@asymmetrik/ngx-leaflet": "^8.1.0",
"leaflet": "^1.7.1",

Answer №1

After upgrading my local Angular version to 11.0.8, I noticed that the import is now functioning correctly. The only other change I made was updating rxjs to 6.6.3, although I don't think that is relevant to the issue at hand. It seems like the error is specific to version 10.0.8.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble with routerLink in your custom library while using Angular 4?

In my Angular 4 project, I have developed a custom sidebar library and integrated it into the main project. My current issue is that I want to provide the option for users to "open in new tab/window" from the browser's context menu without having the ...

Unable to fake a fetch request using the 'fetch-mock-jest 1.5.1' library

I am attempting to simulate a fetch call using thefetch-mock-jest library, but the code continues to try accessing the remote address and ultimately fails with the error message FetchError: request to https://some.domain.io/app-config.yaml failed, reason: ...

Unlock the power of Push Notifications with Ionic!

Currently, I am working on a project using Ionic for front-end development, Node.js + Express for the backend, and MongoDB as the database. My goal is to integrate push notifications into the app. I have come across information about utilizing Firebase f ...

Animating the height of a div based on a condition with *ngIf and CSS

I am working with an angular bloc contained within a container that displays based on a *ngIf condition. <div class="simulation-bloc"> <ng-container *ngIf="type==='simulation'"> // bloc content </ng-cont ...

Tips for wrapping text in a column within material-ui's DataGrid

Struggling to apply word wrap to my column header title in DataGrid from material-ui. I've attempted using sx and style with no success. I even tried this: const StyledDataGridtwo = styled(DataGrid)<DataGridProps>(({ theme }) => ({ root: { ...

How can TypeScript limit the number of properties allowed to be passed as a function parameter?

Here is what I currently have: export interface RegionNode { nodeSelected: boolean; nodeEditable: boolean; zone: Partial<Zone>; parent: RegionNode | null; children: RegionNode[]; } Now, I am looking for a sleek solution to create ...

Error: WebStorm's Language Service has timed out while executing TSLint operations

While working on my Mac running MacOS Sierra with WebStorm (version 2017.2.4), I encounter a pop-up notification sporadically, as shown in the following image: https://i.sstatic.net/mdVtd.png My coworkers and I all have the same TSLint configuration and ...

What's the best way to fix a div to the bottom left corner of the screen?

I have explored various solutions regarding this issue, but none of them seem to meet my specific requirements. What I am trying to achieve is the correct positioning of a div as depicted in the green area in the image. https://i.sstatic.net/O9OMi.png Th ...

What npm package is recommended for implementing Google Analytics in an Angular project?

In need of implementing Google Analytics for my Angular 8 project. Can anyone recommend the top npm package to use for adding analytics from the client side? I've come across several packages, but would greatly appreciate feedback from a developer wit ...

How to transfer the label text value from html to .ts file in Ionic 3?

Hey everyone! I just started using Ionic and I'm wondering how to pass the value of a label text from HTML to the .ts file. Here's a snippet of my code: <div class="box" (click)="openChatBot()"></div> <ion-label>LEADER ...

Is app.component.ts necessary in an Angular 2 project?

Currently diving into Angular 2 and have a burning question on my mind. Do I really need the app.component.ts file in my project? Each of my folders has its own component and template, so I'm debating if the main component is necessary or if I can rem ...

Ways to incorporate External JS and CSS files into Angular 5 (loading files with a delay)

I have encountered some challenges while attempting to import external JS and CSS files into my Angular 5 application. Below is the code snippet that I have tried so far: Component.ts : ngOnInit() { this.loadScript(); // also attempted with ...

Assigning a value to an Angular class variable within the subscribe method of an HTTP

Understanding the inner workings of this process has been a challenge for me. I've come across numerous articles that touch on this topic, but they all seem to emphasize the asynchronous nature of setting the class variable only when the callback is t ...

Avoid flickering of images by properly handling the object URL when setting the image source in an asynchronous pipe

Implementing a JWT authorized endpoint for images has made it impossible to directly link to image urls in HTML. To work around this issue, we have created an async pipe that loads the image with proper authorization (handled by an HTTP interceptor, not s ...

Encountered a problem while trying to set up the Angular Material Library that has been cloned from

Trying to setup a library that has been forked from https://github.com/angular/material2. git clone <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="63040a1723040a170b16014d000c0e">[email protected]</a>:vugar005/m ...

Is it possible to utilize a single node_modules folder for multiple Angular 2/4 projects?

As I dive into the world of Angular, I've noticed that creating a new project can be time-consuming due to the 100MB "node_modules" folder that the CLI generates. The contents of this folder are repetitively consistent across projects, with few change ...

The event handler cdkDropListDropped="drop($event)" is not triggering when interacting with a Material table that has a

Currently, I am working on implementing a column drag-and-drop feature using mat-table and cdkDragDrop in Angular (specifically with Angular 8). Here is the progress I have made so far: Within the component.html file: <mat-table cdkDropList cdkDrop ...

html The "download" attribute causing a new tab to open rather than initiating a

I have a website built with Angular 4, where users can download images from an Amazon S3 bucket. However, I encountered an issue wherein instead of downloading the image, it opens in a new tab. I've tested this problem on different browsers such as Fi ...

Encountering an issue with Typescript and SystemJS: Struggling to locate a

After developing a module, I decided to move it out of the app and into node_modules. However, I encountered an error error TS2307: Cannot find module 'bipartite-graph'.. In this case, bipartite-graph is actually my own module. Here is the conte ...

Is it possible to use Typescript to store and access static global variables based on a unique key

I want to store variables in a static global file, like this: declare const MYVAR = 'Some unchanging data'; Later on, I would like to be able to retrieve the information using just the key 'MYVAR', for example: globalFile.findValue ...