提问者:小点点

如何安装所有react-导航包


我是编码初学者,这意味着我遵循youtube的教程。我正在制作的项目是Uber克隆。当我尝试安装时:

expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

它给我错误消息说:

使用npm安装4SDK45.0.0兼容的本机模块和1个其他软件包。

npm ERR!可以在以下位置找到此运行的完整日志:npm ERR!C:\用户\ps3pl\AppData\本地\npm-cache_logs\2022-06-05T13_17_47_604Z-debug-0. log

这是我的pack. json文件:

{
  "name": "uber-clone",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-navigation/native": "^6.0.10",
    "@reduxjs/toolkit": "^1.8.2",
    "expo": "~45.0.0",
    "expo-status-bar": "~1.3.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-elements": "^3.4.2",
    "react-native-safe-area-context": "4.2.4",
    "react-native-vector-icons": "^9.1.0",
    "react-native-web": "0.17.7",
    "react-redux": "^8.0.2",
    "tailwind-react-native-classnames": "^1.5.1",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-reanimated": "~2.8.0",
    "react-native-screens": "~3.11.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

谢谢你


共3个答案

匿名用户

以下步骤对我有用:

在代码编辑器中打开您的代码,并通过运行npm uninstall react-native-safe-area-context来重新依赖react-native-safe-area-context

运行npm update

匿名用户

首先删除node_modules文件夹,然后通过运行npm install再次安装。然后在代码编辑器中打开您的代码,并通过运行npm uninstall react-native-safe-area-context来删除依赖项

匿名用户

您可以在全球范围内安装它

npm install -g npm@latest

这是我的工作!