如果我更改 common.d.ts ionic serve 正常运行的原因
Posted
技术标签:
【中文标题】如果我更改 common.d.ts ionic serve 正常运行的原因【英文标题】:Reason why if I change common.d.ts ionic serve runs properly 【发布时间】:2020-01-31 19:15:42 【问题描述】:当我执行 ionic serve 时,我有这个错误:
[app-scripts] [15:04:28] 转译开始... [应用脚本] [15:04:42] 打字稿:...aceIcaro_5_3B/dev-app/app/node_modules/@ionic-native/core/decorators/common.d.ts,行:10 [app-scripts] 找不到名称“未知”。 [app-scripts] L9: 导出声明函数 wrapPromise(pluginObj: any, methodName: string, args: any[], opts?: CordovaOptions): Promise; [app-scripts] L11: * 检查插件/cordova 是否可用
我已经读到,如果我在 @ionic-native/core/decorators 的 common.d.ts 第 10 行更改 unknown ,错误就会消失。是真的,但我想知道原因。
我在 package.json 的依赖项是:
“依赖”: "@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/路由器": "^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", “科尔多瓦”:“^9.0.0”, “cordova-android”:“8.1.0”, “科尔多瓦浏览器”:“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 插件文件": "^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", “离子角”:“^3.9.8”, "离子工具提示": "^2.1.1", "ionic2-super-tabs": "^4.3.1", “离子”:“^3.0.0”, "jwt-decode": "^2.2.0", “lodash”:“4.17.11”, “时刻”:“^2.24.0”, "ngx-permissions": "^4.1.0", “节点萨斯”:“^4.11.0”, “运行”:“1.4.0”, "rxjs": "^5.5.12", "sw 工具箱": "3.6.0", “zone.js”:“0.8.26” , “开发依赖”: "@ionic/app-scripts": "^3.2.2", "@ionic/lab": "1.0.6", “打字稿”:“2.8.3”
【问题讨论】:
【参考方案1】:我找到了解决方案。我进行这些更改是因为在以 iOS13 作为操作系统的设备中,我无法可视化本机日历和时钟。
所以我可以说我有两个解决方案。
日历和时钟的问题是由于新的深色模式造成的,因此我强制 iOS 设备在我的应用中使用浅色模式。
依赖关系的问题更复杂。我回到了以前的版本,所以一切正常。如果我想更新我的依赖,我必须将“ionic-angular”替换为“@ionic/angular”,更新打字稿,所有@angular/* 的东西都需要加入@angular/core 和“ionic2-super-tabs”可以产生问题。所以最好生成一个新项目并迁移我的代码。
【讨论】:
以上是关于如果我更改 common.d.ts ionic serve 正常运行的原因的主要内容,如果未能解决你的问题,请参考以下文章