尝试运行ionic serve --devapp
时,我遇到了此错误:
[ng] Cannot destructure property 'styles' of 'undefined' or 'null'.
[ng] TypeError: Cannot destructure property `styles` of 'undefined' or 'null'.
[ng] at Object.getCommonConfig (.node_modules@angular-devkitbuild-angularsrcangular-cli-filesmodelswebpack-configscommon.js:33:107)
我尝试清理 npm 缓存,更新所有依赖项,删除 package-lock.json,然后再次安装。几次。也尝试了 npm ci。似乎没有任何效果。
这是我的包.json:
{
"name": "myludopal",
"version": "1.0.0",
"author": "Mazus DEV",
"homepage": "http://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.2.11",
"@angular/common": "^7.2.11",
"@angular/core": "^7.2.11",
"@angular/forms": "^7.2.11",
"@angular/http": "^7.2.11",
"@angular/platform-browser": "^7.2.11",
"@angular/platform-browser-dynamic": "^7.2.11",
"@angular/router": "^7.2.11",
"@ionic-native/barcode-scanner": "^5.3.0",
"@ionic-native/core": "^5.3.0",
"@ionic-native/file": "^5.3.0",
"@ionic-native/ionic-webview": "5.3.0",
"@ionic-native/splash-screen": "^5.3.0",
"@ionic-native/status-bar": "^5.3.0",
"@ionic/angular": "^4.1.2",
"@ionic/storage": "^2.2.0",
"android-versions": "^1.4.0",
"angular4-knob": "^1.1.11",
"chart.js": "^2.8.0",
"cordova": "^9.0.0",
"cordova-android": "^8.0.0",
"cordova-browser": "^6.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-ionic": "^5.3.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^4.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"core-js": "^3.0.0",
"ionic-image-loader": "^7.0.0-beta.2",
"lodash-es": "^4.17.11",
"ngx-chips": "^2.0.0-beta.0",
"phonegap-plugin-barcodescanner": "^8.0.1",
"rxjs": "^6.4.0",
"zone.js": "0.8.29"
},
"devDependencies": {
"@angular-devkit/architect": "^0.13.7",
"@angular-devkit/build-angular": "^0.13.7",
"@angular-devkit/core": "^7.3.7",
"@angular-devkit/schematics": "^7.3.7",
"@angular/cli": "^7.3.7",
"@angular/compiler": "^7.2.11",
"@angular/compiler-cli": "^7.2.11",
"@angular/language-service": "^7.2.11",
"@ionic/angular-toolkit": "^1.5.0",
"@types/jasmine": "^3.3.12",
"@types/jasminewd2": "^2.0.6",
"@types/lodash-es": "^4.17.3",
"@types/node": "^11.13.0",
"codelyzer": "^5.0.0",
"jasmine-core": "^3.3.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "^5.4.2",
"ts-node": "^8.0.3",
"tslint": "^5.15.0",
"typescript": "3.2.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-file": {}
},
"platforms": [
"browser",
"android"
]
}
}
在网络上找不到任何特定于此的内容,通过查看错误,似乎配置文件缺少"style"属性,我试图进入调用链并找到这是什么文件,但无法做到。
其他构建命令有效:ng serve
,ng build
,甚至ionic cordova build android
工作...
我尝试运行的命令用于使用 devapp android 应用程序测试 Ionic 应用程序。
感谢您的任何想法。
我遇到了同样的问题,问题不在于ionic
,而在于
@ionic/angular-toolkit
,我已将其从1.5.0
降级为1.4.0
,一切再次正常。
仅当您尝试使用实时加载模式运行时,才会发生此错误。
从 4.12 更新到 ionic 4.09 后,这里也有同样的问题。
解决了升级到 @ionic/angula@latest (4.2.0( 的问题