gpt4 book ai didi

android - 使用 --env.aot 标志时未构建 Nativescript 应用程序

转载 作者:行者123 更新时间:2023-12-03 21:04:20 24 4
gpt4 key购买 nike

当我在 AOT 中构建我的 NS 应用程序时,我遇到了一个奇怪的问题.我正在运行命令tns build android --bundle --release --env.aot <other_key_specific_flags>我正在低于错误。

: 'StackLayout' is not a known element:
1. If 'StackLayout' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
</FlexboxLayout>
</StackLayout>
[ERROR ->]<StackLayout *ngIf="dataEmpty" class="m-25">
<Label class="fo-24 text-center" text="No Activitie")
: 'StackLayout' is not a known element:
1. If 'StackLayout' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("[ERROR ->]<StackLayout class="a-m-t-25">
<FlexboxLayout class="app-action-bar" margin="10 5 5 10" justifyCon")


ERROR in ./app/content/profile/profile.component.ts 109:32
Module parse failed: Unexpected token (109:32)
You may need an appropriate loader to handle this file type.
| core_1.Component({
| selector: 'ns-profile',
> /*duleId: module.i*/+ ' ',
| templateUrl: './profile.component.html',
| styleUrls: ['./profile.component.scss']
@ ./app/app.module.ts 33:26-72
@ ./main.ts

我的 app.module.ts 虽然包含 NO_ERRORS_SCHEMA
...
import { CommonModule } from '@angular/common';
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
...

@NgModule({
schemas: [
NO_ERRORS_SCHEMA
],
bootstrap: [
AppComponent
],
imports: [
CommonModule,
NativeScriptModule,
...
],
declarations: [...],
providers: [...]
})
export class AppModule {
}

最佳答案

同样的事情也发生在这里。我通过创建一个与组件同名的模块并添加 NgModule NO_ERRORS_SCHEMA 来解决它。
就像是:

      @NgModule({
schemas: [
NO_ERRORS_SCHEMA
],
bootstrap: [
AppComponent
],
imports: [
CommonModule,
NativeScriptModule,
...
],
declarations: [...],
providers: [...]
})
export class ProfileModule {
}
然后将其导入 app.module。

关于android - 使用 --env.aot 标志时未构建 Nativescript 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55294793/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com