尝试构建时出现错误消息--Ionic应用程序 [英] Error message while trying to build --Ionic App
本文介绍了尝试构建时出现错误消息--Ionic应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ERROR in src/app/components/slides/slides.component.html:1:1 - error NG8001: 'ion-content' is not a
known element:
1. If 'ion-content' is an Angular component, then verify that it is part of this module.
2. If 'ion-content' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas'
of this component to suppress this message.
1 <ion-content>
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
组件SlidesComponent的模板出错。 src/app/components/slides/slides.component.html:2:3-错误NG8001:"离子幻灯片"是未知的 元素: 1.如果"离子幻灯片"是一个角度组件,则确认它是此模块的一部分。 2.如果‘ion-lides’是Web组件,则将‘CUSTOM_ELEMENTS_SCHEMA’添加到的‘@NgModule.schemas’中 此组件以取消显示此消息。
2 <ion-slides pager="true" [options]="slideOpts">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/slides/slides.component.html:2:28 - error NG8002: Can't bind to 'options' since it
isn't a known property of 'ion-slides'.
1. If 'ion-slides' is an Angular component and it has 'options' input, then verify that it is part of
this module.
2. If 'ion-slides' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.
2 <ion-slides pager="true" [options]="slideOpts">
~~~~~~~~~~~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/slides/slides.component.html:3:5 - error NG8001: 'ion-slide' is not a known
element:
1. If 'ion-slide' is an Angular component, then verify that it is part of this module.
2. If 'ion-slide' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
3 <ion-slide>
~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/slides/slides.component.html:8:5 - error NG8001: 'ion-slide' is not a known
element:
1. If 'ion-slide' is an Angular component, then verify that it is part of this module.
2. If 'ion-slide' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
8 <ion-slide>
~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/slides/slides.component.html:12:5 - error NG8001: [0m'ion-slide' is not a known
element:
1. If 'ion-slide' is an Angular component, then verify that it is part of this module.
2. If 'ion-slide' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
12 <ion-slide>
~~~~~~~~~~~
src/app/components/slides/slides.component.ts:5:16
5 templateUrl: './slides.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component SlidesComponent.
src/app/components/start/start.component.html:1:1 - error NG8001: 'ion-button' is not a known
element:
1. If 'ion-button' is an Angular component, then verify that it is part of this module.
2. If 'ion-button' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of
this component to suppress this message.
1 <ion-button expand="full" color='secondary' (click)="navigateToLoginPage()">Start</ion-button>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/start/start.component.ts:6:16
6 templateUrl: './start.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component StartComponent.
[ERROR] An error occurred while running subprocess ng.
ng.cmd run app:build:production exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
推荐答案
检查依赖项注入,验证是否已将组件添加到声明中:Side Main Module中的Array
例如:
declarations: [ AppComponent, HelloComponent,ImageComponent,PonyComponent,RaceComponent ],
使用以下代码而不是ion-button
<button ion-button color="primary">Primary</button>
要解决离子幻灯片问题,请使用任何Beow 2解决方案
您需要将
CUSTOM_ELEMENTS_SCHEMA
添加到NgModule.
中的架构import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; ... @NgModule({ imports: [], ... schemas: [CUSTOM_ELEMENTS_SCHEMA] }) export class YourModule {}
将IonicModule.forRoot()添加到父模块
这篇关于尝试构建时出现错误消息--Ionic应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文