当我从 Ionic 3 升级到 4 时,这发生在我身上。问题是,package.json
两者ionic.config.json
都从 3 更改为 4。因此,当您执行复制粘贴操作时,您必须小心。
Ionic.config.json 类型应该是angular
(以前是“type”:“ionic-angular”)
{
"name": "myProjectName",
"integrations": {
"cordova": {}
},
"type": "angular"
}
package.json 脚本现在遵循 Angular 风格
你可能有过这样的事情
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint --bailOnLintError true",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"ionic:watch:before": "node ./bin/pre-build.js",
"ionic:build:before": "node ./bin/pre-build.js"
},
现在应该在 Ionic 4 中更改为标准角度:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},