【发布时间】:2022-02-24 15:22:15
【问题描述】:
这些天我正在开发一个 angular-CLI 项目。昨天当我尝试在那里创建一个新模块时,终端给出了一个错误提示
Cannot read properties of undefined (reading 'kind')
(只有这个错误没有其他解释)
然后我以同样的方式发现 angular 不允许制作新组件并给出相同的错误。但是ng serve 命令没有任何问题。它工作正常。
如果你能帮我解决这个问题,那将是一个很大的帮助。我将包括一些文件。但是,如果您想了解更多详细信息,请将它们称为 cmets,因为我不明白问题出在哪里。提前致谢
package.json
{
"name": "chess-cabin-front",
"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",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~11.0.4",
"@angular/cdk": "^11.2.5",
"@angular/common": "~11.0.4",
"@angular/compiler": "~11.0.4",
"@angular/core": "~11.0.4",
"@angular/forms": "~11.0.4",
"@angular/localize": "~11.0.4",
"@angular/material": "^11.2.5",
"@angular/platform-browser": "~11.0.4",
"@angular/platform-browser-dynamic": "~11.0.4",
"@angular/router": "~11.0.4",
"@ctrl/ngx-emoji-mart": "^6.0.0",
"@nativescript/angular": "~10.1.0",
"@nativescript/core": "~7.0.0",
"@nativescript/theme": "~2.5.0",
"@ng-bootstrap/ng-bootstrap": "^9.1.3",
"@types/jquery": "^3.5.5",
"admin-lte": "^3.1.0-rc",
"angular-in-memory-web-api": "^0.11.0",
"angularx-social-login": "^3.5.7",
"bootstrap": "^4.6.0",
"emojionearea": "^3.4.2",
"font-awesome": "^4.7.0",
"ionicons": "^5.2.3",
"jquery": "^3.5.1",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1100.4",
"@angular/cli": "~11.0.4",
"@angular/compiler-cli": "~11.0.4",
"@nativescript/android": "8.0.0",
"@nativescript/schematics": "^11.2.0",
"@nativescript/tslint-rules": "~0.0.5",
"@nativescript/webpack": "~3.0.0",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"ngx-progressbar": "^6.1.1",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
},
"main": "main.tns.js"
}
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"Chess-Cabin-Front": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/Chess-Cabin-Front",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss",
"node_modules/@ctrl/ngx-emoji-mart/picker.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"webpack.config.js"
],
"allowedCommonJsDependencies": [
"$.widget.bridge('uibutton', $.ui.button)",
"admin-lte/plugins/bootstrap/js/bootstrap.bundle.min.js",
"admin-lte/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js",
"admin-lte/dist/js/adminlte.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "Chess-Cabin-Front:build"
},
"configurations": {
"production": {
"browserTarget": "Chess-Cabin-Front:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "Chess-Cabin-Front:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "Chess-Cabin-Front:serve"
},
"configurations": {
"production": {
"devServerTarget": "Chess-Cabin-Front:serve:production"
}
}
}
}
}
},
"defaultProject": "Chess-Cabin-Front",
"cli": {
"defaultCollection": "@nativescript/schematics"
}
}
【问题讨论】:
-
只需取消当前控制台并再次运行“ng serve”即可。
-
@RavinderKumar 不,它没有用
标签: angular typescript angular-cli