ERROR in The target entry-point has missing dependencies: for child components

Viewed 4971

I have an angular 8 library lib-a with the child components child-x and child-y.

while consuming the lib-a in angular 9 project getting build error as below:

**ERROR in The target entry-point "@abc/lib-a" has missing dependencies:

  • ./lib-a/child-x/child-x.component
  • ./lib-a/child-y/child-y.component**

And the ng-package.json is,

{
  "$schema": "../../node_modules/ng-package/ng-package.schema.json",
  "dest": "../../dist/lib-a",
  "lib": {
    "entryFile": "src/public-api.ts"
  }
}

and the package.json of lib-a is:

{
  "name": "lib-a",
  "version": "1.0.6",
  "description": "lib a",
  "peerDependencies": {
    "@angular/common": "^8.0.0",
    "@angular/core": "^8.0.0",
    "@angular/elements": "^9.1.6",
    "@angular/cdk": "^8.2.3"
  }
}

Edit: public-api.ts

export * from './lib-a/lib-a.module';
export * from './lib-a/child-x/child-x.component';
export * from './lib-a/child-y/child-y.component';

I tried fixing by adding the components in public-api.ts entry point, but that is not working.

I searched the web but no answers for question-related to this child component.

2 Answers

This problem popped up for me and I was able to solve it. I have an angular library and application within my projects folder. I was playing around with using imports that refrenced the library as opposed to the absolute path of components, ie import {mycomponent} from 'my-library' instead of import {mycomponent} from 'projects/src/lib/<etc>'. Code was lingering that pointed to the dist folder. Once I deleted the dist folder, the real errors showed (these references). Once I fixed these errors the problem was fixed.

One good general and easy solution is to delete node_modules and install them again using command

npm install
Related