android - 在离子构建期间导致未定义不是对象(评估'win ['Ionic']')的原因是什么?
问题描述
很久以前,我刚刚更新了一个项目的所有依赖项。
更新后我在这里遇到了这个问题:“在'@angular/platform-browser'中找不到导出'DOCUMENT' 我做了评论中提到的“解决方法”(编辑node_modules文件夹中的文件)但现在应用程序崩溃了另一个错误...
我在本主题中提到了类似的问题,但仍未得到解答: https ://forum.ionicframework.com/t/error-in-ios-emulator/122022
运行ionic serve
或运行后出现以下错误ionic cordova emulate ios -lcs --prod
Unhandled Promise rejection: – "undefined is not an object (evaluating 'win['Ionic']')" – "; Zone:" – "<root>" – "; Task:" – "Promise.then" – "; Value:" (2)
TypeError: undefined is not an object (evaluating 'win['Ionic']')
"setupConfig@http://localhost:8100/build/vendor.js:31748:23
_createProviderInstance@http://localhost:8100/build/vendor.js:20787:38
initNgModule@http://localhost:8100/build/vendor.js:20717:55
NgModuleRef_@http://localhost:8100/build/vendor.js:21426:21
createNgModuleRef@http://localhost:8100/build/vendor.js:21415:28
http://localhost:8100/build/vendor.js:27281:49
onInvoke@http://localhost:8100/build/vendor.js:26789:39
run@http://localhost:8100/build/polyfills.js:3:10149
run@http://localhost:8100/build/polyfills.js:3:10149
http://localhost:8100/build/polyfills.js:3:20245
runTask@http://localhost:8100/build/polyfills.js:3:10844
o@http://localhost:8100/build/polyfills.js:3:7901
promiseReactionJob@[native code]"
ionic info 命令返回以下内容:
Ionic:
Ionic CLI : 5.4.4 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.9
@ionic/app-scripts : 3.2.4
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 14 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.9
System:
Android SDK Tools : 26.1.1
ios-sim : 8.0.2
NodeJS : v8.11.2
npm : 6.12.0
OS : macOS Mojave
Xcode : Xcode 10.3 Build version 10G8
我安装了以下依赖项
"@angular/animations": "^8.2.11",
"@angular/common": "^8.2.11",
"@angular/compiler": "^8.2.11",
"@angular/compiler-cli": "^8.2.11",
"@angular/core": "^8.2.11",
"@angular/forms": "^8.2.11",
"@angular/http": "^7.2.15",
"@angular/platform-browser": "^8.2.11",
"@angular/platform-browser-dynamic": "^8.2.11",
"@ionic-native/action-sheet": "^5.15.1",
"@ionic-native/base64": "^5.15.1",
"@ionic-native/camera": "^5.15.1",
"@ionic-native/core": "^5.15.1",
"@ionic-native/dialogs": "^5.15.1",
"@ionic-native/facebook": "^5.15.1",
"@ionic-native/google-plus": "^5.15.1",
"@ionic-native/http": "^5.15.1",
"@ionic-native/keyboard": "^5.15.1",
"@ionic-native/network": "^5.15.1",
"@ionic-native/screen-orientation": "^5.15.1",
"@ionic-native/splash-screen": "^5.15.1",
"@ionic-native/status-bar": "^5.15.1",
"@ionic/storage": "^2.2.0",
"com-badrit-base64": "^0.2.0",
"cordova-android": "^8.1.0",
"cordova-ios": "^5.0.1",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-advanced-http": "^2.2.0",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-facebook4": "^6.2.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-googleplus": "^8.1.2",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.1.2",
"cordova-plugin-nativestorage": "^2.3.2",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-screen-orientation": "^3.0.2",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-sqlite-storage": "^3.4.0",
"es6-promise-plugin": "^4.2.2",
"ionic-angular": "^3.9.9",
"ionicons": "4.6.3",
"rxjs": "^6.5.3",
"rxjs-compat": "^6.5.3",
"sw-toolbox": "3.6.0",
"zone.js": "^0.10.2"
解决方案
推荐阅读
- javascript - 将锚的 src 属性值传递给 CF7 的字段
- android - GSON - 使用映射将 JsonObject 转换为 java/Kotlin 对象
- reactjs - 具有“静默”本地 Active Directory 身份验证的 ReactJS 和 .Net Core 应用程序
- sql - UPDATE 中不允许修复 set-returning 函数
- mongodb - 用于嵌入式集合的 MongoDB $lookup
- php - 将 PayStack paymentDetails 数组保存到 laravel 订单表
- dotspatial - 如何从 DemoMap DotSpatial 程序中的插件访问地图控件
- python - 支持英特尔 MKL 的 Python3 numpy [Win10]
- python - Python3中字符串数字列表的排序列表?
- sql-server - 从另一个表插入列值:无法绑定多部分标识符