gpt4 book ai didi

android - Ionic - 意外 token 仅在 Android 5 模拟器中运行时非法

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:47:52 26 4
gpt4 key购买 nike

我正在开发一个 Ionic 应用程序,我遇到了以下问题:

Unexpected token ILLEGAL

奇怪的是,它只发生在我使用 Android 5 和以下版本的 Genymotion 模拟器运行应用程序时,使用 ionic cordova run android。如果我在 Android 6 及更高版本中运行相同的代码,应用程序将正常运行。

控制台说问题出在“{”字符附近:

enter image description here

我尝试重写这段代码,但如果我删除所有空格,它只会将错误更改为另一行。

奇怪的是它只在模拟器中运行时发生,所以我怀疑项目配置中的某些东西,比如 webpack。

Ionic version: 3.19.0 cordova-android: ^6.2.3

这是我的 package.json

{
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "5.0.1",
"@angular/compiler": "5.0.1",
"@angular/compiler-cli": "5.0.1",
"@angular/core": "5.0.1",
"@angular/forms": "5.0.1",
"@angular/http": "5.0.1",
"@angular/platform-browser": "5.0.1",
"@angular/platform-browser-dynamic": "5.0.1",
"@ionic-native/camera": "^4.4.2",
"@ionic-native/core": "4.3.2",
"@ionic-native/date-picker": "^4.4.2",
"@ionic-native/facebook": "^4.4.2",
"@ionic-native/globalization": "^4.4.2",
"@ionic-native/google-plus": "^4.4.2",
"@ionic-native/onesignal": "^4.4.2",
"@ionic-native/splash-screen": "4.3.2",
"@ionic-native/status-bar": "4.3.2",
"@ionic/storage": "^2.1.3",
"@ngx-translate/core": "^9.0.1",
"@ngx-translate/http-loader": "^2.0.0",
"cordova-android": "^6.2.3",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-datepicker": "^0.9.3",
"cordova-plugin-device": "1.1.4",
"cordova-plugin-facebook4": "^1.9.1",
"cordova-plugin-globalization": "^1.0.8",
"cordova-plugin-googleplus": "^5.1.1",
"cordova-plugin-ionic-webview": "^1.1.11",
"cordova-plugin-splashscreen": "~4.0.1",
"cordova-plugin-whitelist": "1.3.1",
"cordova-sqlite-storage": "^2.1.2",
"font-awesome": "^4.7.0",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "~2.2.1",
"ionicons": "3.0.0",
"moment": "^2.19.2",
"ngx-cookie-service": "^1.0.9",
"onesignal-cordova-plugin": "^2.2.2",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.0",
"typescript": "2.4.2"
},
"config": {
"ionic_copy": "./config/copy.config.js"
},
"cordova": {
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-facebook4": {
"APP_ID": "",
"APP_NAME": ""
},
"cordova-plugin-datepicker": {},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": ""
},
"cordova-plugin-globalization": {},
"cordova-plugin-camera": {},
"onesignal-cordova-plugin": {},
"cordova-sqlite-storage": {}
},
"platforms": [
"android"
]
}
}

ionic 信息:

cli packages: (/opt/nvm/versions/node/v7.10.0/lib/node_modules)

@ionic/cli-utils : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node : v7.10.0
npm : 4.2.0
OS : Linux 4.4

Environment Variables:

ANDROID_HOME : /opt/android-sdk-linux

Misc:

backend : pro

最佳答案

似乎需要进行调整

node_modules/@ionic/app-scripts/dist/template.js

更改为:

return getTemplatePrefix(htmlFilePath) + "'" + content + "'" + getTemplateSuffix(htmlFilePath);

一些要删除的反引号。我在这里读到:[ Module parse failed: Unexpected token ionic 3

关于android - Ionic - 意外 token 仅在 Android 5 模拟器中运行时非法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47328879/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com