You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

添加react-native-appflyer后React Native iOS打包遇Unexpected token错误求助

新增react-native-appflyer依赖后iOS打包报错

我在项目中新增依赖包"react-native-appflyer": "^6.8.0",打包React Native iOS应用时出现以下错误:

error
app/views/LoggedIn/WorkoutFeedbackView/WorkoutFeedbackStep1View.tsx:
Unexpected token punc «;», expected punc «,» in file
app/views/LoggedIn/WorkoutFeedbackView/WorkoutFeedbackStep1View.tsx at
208:27. Run CLI with --verbose flag for more details. Error:
Unexpected token punc «;», expected punc «,» in file
app/views/LoggedIn/WorkoutFeedbackView/WorkoutFeedbackStep1View.tsx at
208:27
    at /Users/niklasbraun/Documents/GitHub/heapster/SkillYoga/mobile-app/node_modules/metro/src/JSTransformer/worker.js:430:17
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/niklasbraun/Documents/GitHub/heapster/SkillYoga/mobile-app/node_modules/metro/src/JSTransformer/worker.js:75:24)
    at _next (/Users/niklasbraun/Documents/GitHub/heapster/SkillYoga/mobile-app/node_modules/metro/src/JSTransformer/worker.js:95:9)
    at /Users/niklasbraun/Documents/GitHub/heapster/SkillYoga/mobile-app/node_modules/metro/src/JSTransformer/worker.js:100:7
    at new Promise (<anonymous>)
    at /Users/niklasbraun/Documents/GitHub/heapster/SkillYoga/mobile-app/node_modules/metro/src/JSTransformer/worker.js:92:12
    at JsTransformer._minifyCode (/Users/niklasbraun/Documents/GitHub/heapster/SkillYoga/mobile-app/node_modules/metro/src/JSTransformer/worker.js:437:7)
    at /Users/niklasbraun/Documents/GitHub/heapster/SkillYoga/mobile-app/node_modules/metro/src/JSTransformer/worker.js:367:33

已尝试更新react和react-native,问题未解决。另外,WorkoutFeedbackStep1View.tsx文件实际没有208行,参考相关问题的解决方案也无效。

项目的package.json依赖内容如下:

{
  "dependencies": {
    "@invertase/react-native-apple-authentication": "^2.1.0",
    "@notifee/react-native": "^0.15.2",
    "@react-native-async-storage/async-storage": "^1.15.0",
    "@react-native-community/datetimepicker": "^3.0.9",
    "@react-native-community/netinfo": "^5.9.10",
    "@react-native-community/slider": "^3.0.3",
    "@react-native-firebase/analytics": "^10.5.1",
    "@react-native-firebase/app": "^10.5.0",
    "@react-native-firebase/crashlytics": "^10.5.1",
    "@react-native-firebase/in-app-messaging": "^10.5.1",
    "@react-native-firebase/messaging": "^10.5.1",
    "@react-native-firebase/remote-config": "^10.5.1",
    "@react-native-picker/picker": "^1.9.10",
    "amazon-cognito-identity-js": "^4.5.7",
    "aws-amplify": "^3.3.14",
    "email-validator": "^2.0.4",
    "hex-to-rgba": "^2.0.1",
    "jwt-decode": "^3.1.2",
    "lodash": "^4.17.20",
    "lottie-ios": "3.1.8",
    "lottie-react-native": "^4.0.2",
    "m3u8-parser": "^4.5.0",
    "metro-config": "^0.64.0",
    "moment": "^2.29.1",
    "prop-types": "^15.7.2",
    "react": "16.13.1",
    "react-content-loader": "^5.1.4",
    "react-native": "0.63.4",
    "react-native-adapty": "^1.3.13",
    "react-native-adjust": "^4.29.4",
    "react-native-appsflyer": "^6.8.0",
    "react-native-cache": "^2.0.1",
    "react-native-circular-progress": "^1.3.7",
    "react-native-config": "^1.4.2",
    "react-native-device-info": "^8.0.1",
    "react-native-elements": "^3.2.0",
    "react-native-exception-handler": "^2.10.9",
    "react-native-fbsdk": "^3.0.0",
    "react-native-fs": "^2.17.0",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-hyperlink": "0.0.19",
    "react-native-iap": "^6.2.0",
    "react-native-image-crop-picker": "^0.36.0",
    "react-native-image-marker": "^0.6.1",
    "react-native-keep-awake": "^4.0.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^2.0.2",
    "react-native-modal": "^12.0.0",
    "react-native-navigation": "^7.22.3",
    "react-native-offline": "^5.8.0",
    "react-native-orientation-locker": "^1.2.0",
    "react-native-permissions": "^3.0.1",
    "react-native-rate": "^1.2.4",
    "react-native-safe-area": "^0.5.1",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-share": "^6.2.0",
    "react-native-simple-crypto": "^0.2.15",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-splash-screen": "^3.2.0",
    "react-native-svg": "^12.1.0",
    "react-native-url-polyfill": "^1.2.0",
    "react-native-vector-icons": "^8.1.0",
    "react-native-version-check": "^3.4.2",
    "react-native-video": "^5.1.1",
    "react-native-webview": "^11.2.3",
    "react-redux": "^7.2.2",
    "redux": "^4.0.5",
    "redux-actions": "^2.6.5",
    "redux-devtools-extension": "^2.13.9",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.3.0",
    "remote-redux-devtools": "^0.5.16",
    "rollbar-react-native": "^0.9.1",
    "semver": "^5.7.0",
    "uuid": "^3.4.0",
    "victory-native": "^35.3.1"
  },
  "devDependencies": {
    "@babel/core": "^7.13.1",
    "@babel/runtime": "^7.13.7",
    "@types/jest": "^26.0.20",
    "@types/lodash": "^4.14.168",
    "@types/react": "^17.0.2",
    "@types/react-native": "^0.63.50",
    "@types/react-native-fbsdk": "^3.0.0",
    "@types/react-native-keep-awake": "^2.0.2",
    "@types/react-native-share": "^3.3.1",
    "@types/react-native-snap-carousel": "^3.8.2",
    "@types/react-native-video": "^5.0.4",
    "@types/react-redux": "^7.1.16",
    "@types/react-test-renderer": "^17.0.1",
    "@types/redux-logger": "^3.0.8",
    "@types/remote-redux-devtools": "^0.5.4",
    "@types/uuid": "^8.3.0",
    "@typescript-eslint/eslint-plugin": "^4.15.2",
    "@typescript-eslint/parser": "^4.15.2",
    "babel-eslint": "^10.1.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "colors": "^1.4.0",
    "eslint": "^7.20.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-react": "^7.22.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "graceful-fs": "^4.2.6",
    "jetifier": "^1.6.6",
    "metro-react-native-babel-preset": "^0.66.0",
    "npm-run-all": "^4.1.5",
    "prompts": "^2.4.0",
    "react-dom": "^16.9.0",
    "react-native-schemes-manager": "^2.0.0",
    "typescript": "^4.2.2"
  }
}

内容的提问来源于stack exchange,提问作者profidash_98

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 13:17:00