How to fix error during ng build lib Angular?

Issue

I try to build lib in Angular:

ng build my-lib

I got this error in logs:

[error] Error: Cannot determine the module for class ɵbo in C:/Users/ponomarchuk/Desktop/Новая папка/my-workspace/node_modules/angular-cesium/angular-cesium.d.ts! Add ɵbo to the NgModule to fix it.
Cannot determine the module for class ɵbp in C:/Users/ponomarchuk/Desktop/Новая папка/my-workspace/node_modules/angular-cesium/angular-cesium.d.ts! Add ɵbp to the NgModule to fix it.
Cannot determine the module for class ɵbx in C:/Users/ponomarchuk/Desktop/Новая папка/my-workspace/node_modules/angular-cesium/angular-cesium.d.ts! Add ɵbx to the NgModule to fix it.

    at Object.<anonymous> (C:\Users\ponomarchuk\Desktop\Новая папка\my-workspace\node_modules\ng-packagr\lib\ngc\compile-source-files.js:77:19)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\ponomarchuk\Desktop\Новая папка\my-workspace\node_modules\ng-packagr\lib\ngc\compile-source-files.js:4:58)

Lib has package.json:

{
  "name": "cesium-panorama-lib",
  "version": "0.0.1",
  "peerDependencies": {
    "@angular/common": "^8.2.14",
    "@angular/core": "^8.2.14"
  }
}

So, all dependencies are installed.

Root lib module is:

import { NgModule } from "@angular/core";
import { CesiumPanoramaLibComponent } from "./cesium-panorama-lib.component";
import { AngularCesiumModule } from "angular-cesium";

@NgModule({
  declarations: [CesiumPanoramaLibComponent],
  imports: [AngularCesiumModule.forRoot()],
  providers: [{ provide: "Window", useValue: window }],
  exports: [CesiumPanoramaLibComponent],
})
export class CesiumPanoramaLibModule {}

Solution

Try this cannot determine the module for component angular 5 and this How to add and install peer dependencies in Angular library

Do you use this lib in your separate angular application? It seems that AngularCesiumModule is not installed. You should install it with you library or application that uses your library should have this package already installed (in this case package name should be added to peerDependencies section of library package.json)

Answered By – Maksat Rahmanov

Answer Checked By – Mary Flores (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.