gpt4 book ai didi

angular - Nativescript Angular 错误 NG8001 : 'StackLayout' is not a known element:

转载 作者:行者123 更新时间:2023-12-05 01:33:49 25 4
gpt4 key购买 nike

src/app/components/dashboard/dashboard.component.html:1:1 中的错误 - 错误 NG8001:'StackLayout' 是不是已知元素:

  1. 如果“StackLayout”是一个 Angular 组件,则验证它是该模块的一部分。
  2. 要允许任何元素,请将“NO_ERRORS_SCHEMA”添加到此组件的“@NgModule.schemas”。

1

dashboard.component.tns.html

<StackLayout>
<Label text="dashboard works" textWrap="true"></Label>
<Label text="This is a migrated component" textWrap="true"></Label>
<Label text="Update it to provide the UI elements required in your mobile app" textWrap="true"></Label>
</StackLayout>

包.json

{
"name": "angular-google-identity",
"version": "0.0.0",
"scripts": {
"android": "ns run android --no-hmr",
"ios": "ns run ios --no-hmr",
"mobile": "ns run",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"eslint": "eslint 'src/**/*.ts'",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^10.1.5",
"@angular/common": "~10.0.9",
"@angular/compiler": "~10.0.9",
"@angular/core": "~10.0.9",
"@angular/forms": "~10.0.9",
"@angular/localize": "~10.0.9",
"@angular/platform-browser": "~10.0.9",
"@angular/platform-browser-dynamic": "~10.0.9",
"@angular/router": "~10.0.9",
"@angular/service-worker": "~10.0.9",
"@nativescript/angular": "~10.1.0",
"@nativescript/core": "~7.0.0",
"@nativescript/theme": "~2.5.0",
"@ng-bootstrap/ng-bootstrap": "^7.0.0",
"@stomp/ng2-stompjs": "^7.2.0",
"@types/node-rsa": "^1.0.0",
"@types/socket.io-client": "^1.4.33",
"aes-js": "^3.1.2",
"angularx-social-login": "^3.2.1",
"bootstrap": "^4.5.0",
"constants": "0.0.2",
"core-js": "^3.6.5",
"crypto": "^1.0.1",
"event-source-polyfill": "^1.0.16",
"idb": "^5.0.4",
"mediasoup-client": "^3.6.12",
"moment": "^2.27.0",
"nativescript-secure-storage": "^2.6.2",
"ng-gapi": "0.0.93",
"ngx-avatar": "^4.0.0",
"ngx-contextmenu": "^5.4.0",
"ngx-infinite-scroll": "^9.0.0",
"ngx-link-preview": "^1.1.6",
"ngx-logger": "^4.1.9",
"ngx-webcam": "^0.3.0",
"node-rsa": "^1.1.1",
"primeng": "^10.0.0-rc.3",
"recordrtc": "^5.6.1",
"reflect-metadata": "~0.1.12",
"rxjs": "~6.6.2",
"rxjs-compat": "^6.6.3",
"secure-ls": "^1.2.6",
"socket.io": "^2.3.0",
"socket.io-client": "^2.3.0",
"stompjs": "^2.3.3",
"tslib": "^2.0.1",
"webrtc-adapter": "^7.7.0",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1000.6",
"@angular/cli": "~10.0.6",
"@angular/compiler-cli": "~10.0.9",
"@angular/language-service": "~10.0.9",
"@nativescript/android": "7.0.0",
"@nativescript/schematics": "^10.1.0",
"@nativescript/tslint-rules": "~0.0.5",
"@nativescript/webpack": "~3.0.0",
"@types/jasmine": "~3.5.12",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^14.6.0",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/eslint-plugin-tslint": "^3.9.1",
"@typescript-eslint/parser": "^4.1.0",
"codelyzer": "~6.0.0",
"eslint": "^7.8.1",
"eslint-config-google": "^0.14.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.2",
"karma": "~5.1.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "^7.0.0",
"ts-node": "~8.10.2",
"tslint": "~6.1.3",
"typescript": "~3.9.7"
},
"main": "main.tns.js"
}

另外 app.module.tns.ts 也有模式:[NO_ERRORS_SCHEMA]

运行tns build android --bundle时遇到错误

最佳答案

刚刚意识到 app.module.tns.ts 没有声明可解决问题的 Dashboard 组件。

@NgModule({
declarations: [
AppComponent,
AutoGeneratedComponent,
DashboardComponent
],

关于angular - Nativescript Angular 错误 NG8001 : 'StackLayout' is not a known element:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64327266/

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