在离子4中,ionic serve
已成功完成。在浏览器中打开应用程序时,出现以下错误,并且没有任何加载。
AppComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Class constructor EventEmitter cannot be invoked without 'new'
at new BackButtonEmitter (platform.js:17)
at new Platform (platform.js:32)
at _createClass (core.js:10354)
at _createProviderInstance (core.js:10321)
at resolveNgModuleDep (core.js:10266)
at NgModuleRef_.get (core.js:11373)
at resolveDep (core.js:11865)
at createClass (core.js:11736)
at createDirectiveInstance (core.js:11559)
at createViewNodes (core.js:13100)
我推荐了Babel error: Class constructor Foo cannot be invoked without 'new',但没有帮助。
Package.json如下所示。
"name": "T.S.S",
"version": "0.0.1",
"author": "Ionic Framework",
"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": "^6.1.9",
"@angular/common": "~6.1.1",
"@angular/core": "^6.1.9",
"@angular/forms": "~6.1.1",
"@angular/http": "~6.1.1",
"@angular/platform-browser": "~6.1.1",
"@angular/platform-browser-dynamic": "^6.1.3",
"@angular/router": "~6.1.1",
"@ctrl/ngx-chartjs": "^1.0.3",
"@ionic-native/core": "5.0.0-beta.14",
"@ionic-native/date-picker": "^4.15.0",
"@ionic-native/ionic-webview": "^5.0.0-beta.17",
"@ionic-native/splash-screen": "5.0.0-beta.14",
"@ionic-native/status-bar": "5.0.0-beta.14",
"@ionic/angular": "^4.0.0-beta.0",
"angular-2-dropdown-multiselect": "^1.8.1",
"chart.js": "^2.7.2",
"cordova-android": "7.0.0",
"cordova-browser": "5.0.4",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.1.2",
"cordova-plugin-ionic-webview": "^2.1.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"core-js": "^2.5.3",
"install": "^0.12.1",
"lodash": "^4.17.10",
"ng2-datepicker": "^3.1.1",
"ng4-loading-spinner": "^1.2.3",
"ngx-owl-carousel": "^2.0.7",
"rxjs": "6.2.2",
"typescriptnpm": "^1.0.1",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/architect": "~0.7.2",
"@angular-devkit/build-angular": "^0.7.5",
"@angular-devkit/core": "~0.7.2",
"@angular-devkit/schematics": "~0.7.2",
"@angular/cli": "^6.1.5",
"@angular/compiler": "^6.1.3",
"@angular/compiler-cli": "^6.1.6",
"@angular/language-service": "~6.1.1",
"@ionic/ng-toolkit": "^1.0.0",
"@ionic/schematics-angular": "^1.0.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.7.1",
"codelyzer": "~4.4.2",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"primeicons": "^1.0.0-beta.10",
"primeng": "^6.1.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "^2.9.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-ionic-webview": {}
},
"platforms": [
"android",
"browser"
]
}
}
也与Ionic产生了问题。 https://github.com/ionic-team/ionic/issues/15939。
关于使应用程序正常运行的任何建议?
答案 0 :(得分:0)
最近对@ionic/angular
的{{3}}提交有问题。
要使其正常运行,请删除node_modules/@ionic/angular
文件夹并安装旧版本。
我运行npm i @ionic/angular@4.0.0-beta.0
来解决我的问题。