第一次运行reactnative项目时如何解决这个错误

t98cgbkg  于 2023-03-31  发布在  React
关注(0)|答案(1)|浏览(111)

我是第一次创建这个项目,运行它会导致一些错误,我不能解决&
这是package.json文件

{
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "axios": "^1.3.4",
    "expo": "^48.0.7",
    "expo-constants": "~14.2.1",
    "expo-font": "^11.1.1",
    "expo-linking": "~4.0.1",
    "expo-router": "^1.2.0",
    "expo-splash-screen": "~0.18.1",
    "expo-status-bar": "~1.4.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.71.4",
    "react-native-dotenv": "^3.4.8",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-reanimated": "~2.14.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.20.0",
    "react-native-web": "~0.18.7"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9"
  },
  "resolutions": {
    "metro": "^0.73.7",
    "metro-resolver": "^0.73.7"
  },
  "overrides": {
    "metro": "^0.73.7",
    "metro-resolver": "^0.73.7"
  },
  "name": "reactnativejs",
  "version": "1.0.0",
  "private": true
}

这是我尝试npm start

时得到的第一个错误
这是我尝试安装reactnative@0.71.4

时的第二个错误

fae0ux8s

fae0ux8s1#

这里有一个依赖性的冲突,这是如何解决它
1.删除node_modules和程序包锁. json
1.在终端上运行'npm cache clean --force'
1.运行'npm install'
这三个步骤将解决问题,应用程序将正确运行

相关问题