尝试启动反应本机应用程序时出错

Posted

技术标签:

【中文标题】尝试启动反应本机应用程序时出错【英文标题】:Error when trying to start the react native app 【发布时间】:2020-07-25 10:57:17 【问题描述】:

尝试启动我的 react-native 应用程序时出现以下错误。我已经更新了 react-native 版本,这个问题开始出现了。

错误:-

Failed building javascript bundle.
Unable to resolve "./AR" from "node_modules/expo/build/deprecated.js"

package.json

"dependencies": 
    "@expo/vector-icons": "^10.2.0",
    "@react-native-community/masked-view": "0.1.6",
    "axios": "^0.19.2",
    "expo-barcode-scanner": "~8.1.0",
    "expo-permissions": "~8.1.0",
    "expo-video-player": "^1.5.8",
    "react-native-camera": "^3.33.0",
    "react-native-countdown-circle-timer": "^2.2.2",
    "react-native-elements": "^2.0.2",
    "react-native-fast-image": "^8.3.2",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-loading-spinner-overlay": "^1.1.0",
    "react-native-orientation": "^3.1.3",
    "react-native-paper": "^3.10.1",
    "react-native-permissions": "^2.1.5",
    "react-native-safe-area-context": "0.7.3",
    "react-native-slider": "^0.11.0",
    "react-native-triangle": "0.0.9",
    "react-navigation": "^4.3.9",
    "react-navigation-stack": "^2.5.1",
    "react-navigation-tabs": "^2.8.13",
    "react-redux": "^7.2.0",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0", 
    "expo": "~38.0.1",
    "expo-splash-screen": "~0.4.0",
    "expo-status-bar": "^1.0.0",
    "expo-updates": "~0.2.10",
    "react": "~16.11.0",
    "react-dom": "~16.11.0",
    "react-native": "~0.62.2",
    "react-native-gesture-handler": "~1.6.1",
    "react-native-reanimated": "~1.9.0",
    "react-native-screens": "~2.9.0",
    "react-native-unimodules": "~0.10.1",
    "react-native-web": "~0.11.7"
  ,
  "devDependencies": 
    "@babel/core": "~7.9.0",
    "babel-jest": "~25.2.6",
    "jest": "~25.2.6",
    "react-test-renderer": "~16.11.0",
    "prop-types": "^15.7.2"
  ,

谁能帮助我做错了什么?似乎是依赖版本的问题。

【问题讨论】:

在执行 npm-check-updates ncu -u 后遇到同样的问题 【参考方案1】:

清除 Metro bundler 缓存对我有用:

expo start -c

【讨论】:

以上是关于尝试启动反应本机应用程序时出错的主要内容,如果未能解决你的问题,请参考以下文章

在 Web 平台上使用异步存储运行反应本机项目时出错

尝试安装本机反应时出错,运行 pod install 时无法正确构建

启动反应应用程序时出错

在反应本机 ios 应用程序中使用超级代理时出错

如何从 iOS 传递信息以在启动时做出本机反应?

在反应本机应用程序中使用 AWS Amplify 在 GraphQL 突变中出错