如果我更改 common.d.ts ionic serve 正常运行的原因
Reason why if I change common.d.ts ionic serve runs properly
当我执行 ionic serve 时,出现以下错误:
[app-scripts] [15:04:28] transpile started ...
[app-scripts] [15:04:42] typescript: ...aceIcaro_5_3B/dev-app/app/node_modules/@ionic-native/core/decorators/common.d.ts, line: 10
[app-scripts] Cannot find name 'unknown'.
[app-scripts] L9: export declare function wrapPromise(pluginObj: any, methodName: string, args: any[], opts?: CordovaOptions): Promise;
[app-scripts] L11: * Checks if plugin/cordova is available
我读到,如果我在@ionic-native/core/decorators 的 common.d.ts 的第 10 行更改 unknown for any,错误就会消失。是真的,但我想知道原因。
我在 package.json 的依存关系是:
"dependencies": {
"@angular/animations": "^5.2.11",
"@angular/common": "^5.2.11",
"@angular/compiler": "^5.2.11",
"@angular/compiler-cli": "^5.2.11",
"@angular/core": "^5.2.11",
"@angular/forms": "^5.2.11",
"@angular/http": "^5.2.11",
"@angular/platform-browser": "^5.2.11",
"@angular/platform-browser-dynamic": "^5.2.11",
"@angular/router": "^5.2.11",
"@auth0/angular-jwt": "^1.2.0",
"@ionic-native/app-version": "5.14.0",
"@ionic-native/core": "5.14.0",
"@ionic-native/date-picker": "5.14.0",
"@ionic-native/file": "^5.14.0",
"@ionic-native/file-opener": "^5.14.0",
"@ionic-native/globalization": "5.14.0",
"@ionic-native/in-app-browser": "5.14.0",
"@ionic-native/ionic-webview": "5.14.0",
"@ionic-native/splash-screen": "5.14.0",
"@ionic-native/status-bar": "5.14.0",
"@ionic/storage": "2.2.0",
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^2.0.1",
"@types/lodash": "4.14.118",
"cordova": "^9.0.0",
"cordova-android": "8.1.0",
"cordova-browser": "6.0.0",
"cordova-ios": "5.0.1",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-datepicker": "^0.9.3",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-opener2": "^2.2.1",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-inappbrowser": "^3.1.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.2",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "git+https://github.com/apache/cordova-plugin-statusbar.git",
"cordova-plugin-whitelist": "^1.3.4",
"ionic-angular": "^3.9.8",
"ionic-tooltips": "^2.1.1",
"ionic2-super-tabs": "^4.3.1",
"ionicons": "^3.0.0",
"jwt-decode": "^2.2.0",
"lodash": "4.17.11",
"moment": "^2.24.0",
"ngx-permissions": "^4.1.0",
"node-sass": "^4.11.0",
"run": "1.4.0",
"rxjs": "^5.5.12",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.2",
"@ionic/lab": "1.0.6",
"typescript": "2.8.3"
}
我找到了解决办法。我进行这些更改是因为在 iOS13 为 OS 的设备中,我无法看到本机日历和时钟。
所以我可以说我有两个解决方案。
日历和时钟的问题是由于新的深色模式,所以我强制 iOS 的设备在我的应用程序中使用浅色模式。
依赖关系的问题比较复杂。我回到了以前的版本,所以一切正常。如果我想更新我的依赖项,我必须将“ionic-angular”替换为“@ionic/angular”,更新打字稿,所有@angular/* 东西都需要加入@angular/core 和“ionic2-super-tabs”会产生问题。所以不如生成一个新项目,然后迁移我的代码。
当我执行 ionic serve 时,出现以下错误:
[app-scripts] [15:04:28] transpile started ... [app-scripts] [15:04:42] typescript: ...aceIcaro_5_3B/dev-app/app/node_modules/@ionic-native/core/decorators/common.d.ts, line: 10 [app-scripts] Cannot find name 'unknown'. [app-scripts] L9: export declare function wrapPromise(pluginObj: any, methodName: string, args: any[], opts?: CordovaOptions): Promise; [app-scripts] L11: * Checks if plugin/cordova is available
我读到,如果我在@ionic-native/core/decorators 的 common.d.ts 的第 10 行更改 unknown for any,错误就会消失。是真的,但我想知道原因。
我在 package.json 的依存关系是:
"dependencies": { "@angular/animations": "^5.2.11", "@angular/common": "^5.2.11", "@angular/compiler": "^5.2.11", "@angular/compiler-cli": "^5.2.11", "@angular/core": "^5.2.11", "@angular/forms": "^5.2.11", "@angular/http": "^5.2.11", "@angular/platform-browser": "^5.2.11", "@angular/platform-browser-dynamic": "^5.2.11", "@angular/router": "^5.2.11", "@auth0/angular-jwt": "^1.2.0", "@ionic-native/app-version": "5.14.0", "@ionic-native/core": "5.14.0", "@ionic-native/date-picker": "5.14.0", "@ionic-native/file": "^5.14.0", "@ionic-native/file-opener": "^5.14.0", "@ionic-native/globalization": "5.14.0", "@ionic-native/in-app-browser": "5.14.0", "@ionic-native/ionic-webview": "5.14.0", "@ionic-native/splash-screen": "5.14.0", "@ionic-native/status-bar": "5.14.0", "@ionic/storage": "2.2.0", "@ngx-translate/core": "^9.1.1", "@ngx-translate/http-loader": "^2.0.1", "@types/lodash": "4.14.118", "cordova": "^9.0.0", "cordova-android": "8.1.0", "cordova-browser": "6.0.0", "cordova-ios": "5.0.1", "cordova-plugin-app-version": "^0.1.9", "cordova-plugin-datepicker": "^0.9.3", "cordova-plugin-device": "^2.0.3", "cordova-plugin-file": "^6.0.2", "cordova-plugin-file-opener2": "^2.2.1", "cordova-plugin-globalization": "^1.11.0", "cordova-plugin-inappbrowser": "^3.1.0", "cordova-plugin-ionic-keyboard": "^2.2.0", "cordova-plugin-ionic-webview": "^4.1.2", "cordova-plugin-splashscreen": "^5.0.3", "cordova-plugin-statusbar": "git+https://github.com/apache/cordova-plugin-statusbar.git", "cordova-plugin-whitelist": "^1.3.4", "ionic-angular": "^3.9.8", "ionic-tooltips": "^2.1.1", "ionic2-super-tabs": "^4.3.1", "ionicons": "^3.0.0", "jwt-decode": "^2.2.0", "lodash": "4.17.11", "moment": "^2.24.0", "ngx-permissions": "^4.1.0", "node-sass": "^4.11.0", "run": "1.4.0", "rxjs": "^5.5.12", "sw-toolbox": "3.6.0", "zone.js": "0.8.26" }, "devDependencies": { "@ionic/app-scripts": "^3.2.2", "@ionic/lab": "1.0.6", "typescript": "2.8.3" }
我找到了解决办法。我进行这些更改是因为在 iOS13 为 OS 的设备中,我无法看到本机日历和时钟。
所以我可以说我有两个解决方案。
日历和时钟的问题是由于新的深色模式,所以我强制 iOS 的设备在我的应用程序中使用浅色模式。
依赖关系的问题比较复杂。我回到了以前的版本,所以一切正常。如果我想更新我的依赖项,我必须将“ionic-angular”替换为“@ionic/angular”,更新打字稿,所有@angular/* 东西都需要加入@angular/core 和“ionic2-super-tabs”会产生问题。所以不如生成一个新项目,然后迁移我的代码。