库组件抛出错误,因为“ lib-ibo-header”不是已知元素。

我创建了一个角度库。我在这里创建后是我的库模块:

import { NgModule } from '@angular/core';
import { IBOlibraryComponent } from './ibo-library.component';
import { IboHeaderComponent } from './ibo-header/ibo-header.component';

@NgModule({
  declarations: [IBOlibraryComponent,IboHeaderComponent],imports: [],exports: [IBOlibraryComponent,IboHeaderComponent]
})
export class IBOlibraryModule { }

这是我的public-api

export * from './lib/ibo-library.service';
export * from './lib/ibo-library.component';
export * from './lib/ibo-header/ibo-header.component';
export * from './lib/ibo-library.module';

在我使用yarn-pack打包后,它产生了tgz文件。 但是,当我开始导入其他应用程序时,ibo-library.component-选择器有效。但是ibo-header.component选择器不起作用。

将错误抛出为:

1. If 'lib-ibo-header' is an Angular component,then verify that it is part of this module.
2. If 'lib-ibo-header' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<lib-ibo-header></lib-ibo-header>"): 

我在这里想念的。有人可以帮我吗?

注意:我通过在模块文件夹中以ibo-header.component运行命令来创建ng g c ibo-header-是否需要向上更新?

更新

仅当我通过以下命令运行库来安装库时才会出现:

yarn add ./../IBO-library/dist/ibo-lib/ibo-lib-v0.0.1.tgz

如果我像这样安装: yarn add ./../IBO-library-正常。

要处理ibo-lib-v0.0.1.tgz-是否需要任何特殊命令或安装?

ingkao84 回答:库组件抛出错误,因为“ lib-ibo-header”不是已知元素。

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3095210.html

大家都在问