将expo SDK从42升级到43后,Expo React Native应用程序无法启动

问题描述 投票:0回答:2

我刚刚使用“expo Upgrade 43”将我的 React Native 应用程序中的 expo SDK 从 42 升级到 43,并且收到一条错误消息:

AsyncStorage has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. See https://github.com/react-native-async-storage/async-storage
at node_modules/react-native/Libraries/Utilities/warnOnce.js:27:2 in warnOnce
at node_modules/react-native/index.js:300:12 in module.exports.get__AsyncStorage
at node_modules/@firebase/app/dist/index.rn.cjs.js:615:0 in <global>
at node_modules/metro-runtime/src/polyfills/require.js:349:11 in loadModuleImplementation
at node_modules/@firebase/firestore/dist/rn/index.js:1:0 in <global>
at node_modules/metro-runtime/src/polyfills/require.js:349:11 in loadModuleImplementation
at node_modules/firebase/firestore/dist/index.node.cjs.js:3:7 in <global>
at node_modules/metro-runtime/src/polyfills/require.js:349:11 in loadModuleImplementation
at App.js:1:0 in <global>
at node_modules/metro-runtime/src/polyfills/require.js:349:11 in loadModuleImplementation
at node_modules/expo/AppEntry.js:3:0 in <global>
at node_modules/metro-runtime/src/polyfills/require.js:349:11 in loadModuleImplementation
at node_modules/metro-runtime/src/polyfills/require.js:201:44 in guardedLoadModule
at http://192.168.100.149:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:624639:3 in global code

TypeError: (0, _expoModulesCore.requireNativeModule) is not a function. (In '(0, _expoModulesCore.requireNativeModule)('ExpoCrypto')', '(0, _expoModulesCore.requireNativeModule)' is undefined)
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules/metro-runtime/src/polyfills/require.js:204:6 in guardedLoadModule
at http://192.168.100.149:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:624639:3 in global code

Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError

我不知道到底是什么导致了错误。无论是 expo-modules-core 还是 AsyncStorage。我在网上搜索了解决方案,其中有人建议我删除 node_modules 文件夹和 package-lock.json 并再次重新安装所有包,但仍然遇到相同的错误。

我的项目环境:

  • 节点v16.15.1
  • 纱线 v1.22.19
  • expo-cli v5.4.6
  • Expo Go最新版本

我的package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "start:sandbox": "MY_ENVIRONMENT=sandbox expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "storybook": "start-storybook -p 7007",
    "build-storybook": "build-storybook",
    "prestorybook": "rnstl",
    "lint": "eslint --fix .",
    "format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md}' --config ./.prettierrc",
    "test:android": "cavy run-android --skipbuild",
    "build:sandbox:android": "MY_ENVIRONMENT=sandbox expo build:android --release-channel sandbox",
    "build:sandbox:ios": "MY_ENVIRONMENT=sandbox expo build:ios --release-channel sandbox",
    "publish:sandbox": "MY_ENVIRONMENT=sandbox expo publish --release-channel sandbox",
    "build:prod:android": "expo build:android --release-channel v1.1.5",
    "build:prod:ios": "expo build:ios --release-channel v1.1.5",
    "publish:prod": "expo publish --release-channel v1.1.5"
  },
  "dependencies": {
    "@eva-design/eva": "^2.0.0",
    "@expo-google-fonts/signika": "^0.1.0",
    "@expo/vector-icons": "^12.0.0",
    "@expo/webpack-config": "^0.16.2",
    "@gorhom/bottom-sheet": "3.6.5",
    "@react-native-async-storage/async-storage": "~1.15.0",
    "@react-native-community/checkbox": "^0.5.7",
    "@react-native-community/datetimepicker": "3.5.2",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/picker": "^1.8.1",
    "@react-native-community/segmented-control": "2.2.1",
    "@react-native-community/viewpager": "5.0.11",
    "@react-navigation/bottom-tabs": "^5.11.2",
    "@react-navigation/material-top-tabs": "^5.3.13",
    "@react-navigation/native": "^5.8.10",
    "@react-navigation/stack": "^5.12.8",
    "date-fns": "^2.16.1",
    "expo": "^43.0.0",
    "expo-app-loading": "~1.2.1",
    "expo-asset": "~8.4.3",
    "expo-camera": "~12.0.3",
    "expo-cellular": "~4.0.0",
    "expo-constants": "~12.1.3",
    "expo-device": "~4.0.3",
    "expo-facebook": "~12.0.3",
    "expo-firebase-analytics": "~5.0.3",
    "expo-firebase-core": "~4.0.3",
    "expo-firebase-recaptcha": "~2.0.2",
    "expo-firestore-offline-persistence": "^0.1.0",
    "expo-font": "~10.0.3",
    "expo-image-manipulator": "~10.1.2",
    "expo-image-picker": "~11.0.3",
    "expo-linking": "~2.4.2",
    "expo-media-library": "~13.0.3",
    "expo-network": "~4.0.3",
    "expo-notifications": "~0.13.3",
    "expo-permissions": "~13.0.3",
    "expo-screen-orientation": "~4.0.3",
    "expo-secure-store": "~11.0.3",
    "expo-splash-screen": "~0.13.5",
    "expo-sqlite": "~10.0.3",
    "expo-status-bar": "~1.1.0",
    "expo-store-review": "~5.0.3",
    "expo-task-manager": "~10.0.3",
    "expo-tracking-transparency": "~2.0.3",
    "expo-updates": "~0.10.15",
    "expo-web-browser": "~10.0.3",
    "firebase": "8.2.3",
    "formik": "^2.2.6",
    "indexeddbshim": "6.6.0",
    "lodash": "^4.17.20",
    "p-iteration": "^1.1.8",
    "prop-types": "^15.7.2",
    "qs": "^6.9.6",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-hot-toast": "^1.0.2",
    "react-native": "0.64.3",
    "react-native-background-actions": "^2.6.7",
    "react-native-calendars": "^1.1129.0",
    "react-native-expo-cached-image": "^1.3.1",
    "react-native-gesture-handler": "~1.10.2",
    "react-native-gifted-chat": "^0.16.3",
    "react-native-google-places-autocomplete": "^2.1.2",
    "react-native-image-gallery": "^2.1.5",
    "react-native-keyboard-avoiding-scroll-view": "^1.0.1",
    "react-native-modal-datetime-picker": "^9.1.0",
    "react-native-modal-dropdown": "https://github.com/siemiatj/react-native-modal-dropdown",
    "react-native-onboarding-swiper": "^1.1.4",
    "react-native-phone-number-input": "^2.0.0",
    "react-native-ratings": "^7.4.0",
    "react-native-reanimated": "~2.2.0",
    "react-native-redash": "^16.0.11",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "~3.8.0",
    "react-native-search-filter": "^0.1.5",
    "react-native-svg": "12.1.1",
    "react-native-tab-view": "^2.15.2",
    "react-native-tailwindcss": "^1.1.11",
    "react-native-url-polyfill": "^1.2.0",
    "react-native-web": "0.17.1",
    "react-native-webview": "11.13.0",
    "react-native-woodpicker": "^0.2.8",
    "react-redux": "^7.2.2",
    "react-redux-firebase": "^3.10.0",
    "redux": "^4.0.5",
    "redux-firestore": "https://bitbucket.org/handytradiegh/redux-firestore",
    "redux-persist": "^6.0.0",
    "rxjs": "^6.6.6",
    "sentry-expo": "^4.0.0",
    "yup": "^0.32.8"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "@babel/plugin-syntax-class-properties": "^7.12.13",
    "@babel/plugin-transform-react-jsx-source": "^7.12.1",
    "@storybook/addon-actions": "^5.3",
    "@storybook/addon-knobs": "^5.3",
    "@storybook/addon-links": "^5.3",
    "@storybook/addon-ondevice-actions": "^5.3.23",
    "@storybook/addon-ondevice-knobs": "^5.3.23",
    "@storybook/react-native": "^5.3.23",
    "@storybook/react-native-server": "^5.3.23",
    "babel-eslint": "^10.1.0",
    "babel-loader": "^8.2.2",
    "babel-plugin-module-resolver": "^4.1.0",
    "cavy": "^4.0.1",
    "eslint": "^7.18.0",
    "eslint-config-prettier": "^7.1.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-react": "^7.22.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-react-native": "^3.10.0",
    "eslint-plugin-simple-import-sort": "^7.0.0",
    "prettier": "^2.2.1",
    "prettier-plugin-organize-imports": "^1.1.1",
    "react-native-storybook-loader": "^2.0.2",
    "typescript": "~4.3.5"
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base)"
    ],
    "setupFilesAfterEnv": [
      "<rootDir>/__mocks__/globalMock.js"
    ]
  },
  "config": {
    "react-native-storybook-loader": {
      "searchDir": [
        "./src"
      ],
      "pattern": "**/*.stories.js",
      "outputFile": "./storybook/storyLoader.js"
    }
  },
  "private": true,
  "resolutions": {
    "@react-native-community/picker": "^1.8.1"
  }
}

请帮帮我!!!

node.js react-native expo node-modules
2个回答
0
投票

有人找到解决方案吗?我也有同样的问题。


-1
投票

删除节点模块

yarn.lock
package-lock.json
,然后运行

npm install
© www.soinside.com 2019 - 2024. All rights reserved.