Home > Mobile >  Getting these errors while installing packages on react native
Getting these errors while installing packages on react native

Time:02-02

I am getting these errors while installing react-native-linear-gradient, even for uninstalling and updating I am getting the same errors.

PS C:\Users\sawan\OneDrive\Desktop\WorkoutApp\workout> npm install react-native-linear-gradient npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! peer react@">=16.3.0" from @callstack/[email protected] npm ERR! node_modules/@callstack/react-theme-provider npm ERR! @callstack/react-theme-provider@"^3.0.8" from [email protected] npm ERR! node_modules/react-native-paper npm ERR! peer react-native-paper@"*" from [email protected] npm ERR! node_modules/react-native-material-dropdown-v2-fixed npm ERR! react-native-material-dropdown-v2-fixed@"^0.11.3" from the root project npm ERR! peer react@"*" from @react-navigation/[email protected] npm ERR! node_modules/@react-navigation/bottom-tabs npm ERR! @react-navigation/bottom-tabs@"^6.5.2" from the root project npm ERR! 23 more (@react-navigation/core, @react-navigation/elements, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"18.2.0" from [email protected] npm ERR! node_modules/react-native-windows npm ERR! peer react-native-windows@">=0.63.3" from [email protected] npm ERR! node_modules/react-native-orientation-locker npm ERR! react-native-orientation-locker@"^1.5.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/react npm ERR! peer react@"18.2.0" from [email protected] npm ERR! node_modules/react-native-windows npm ERR! peer react-native-windows@">=0.63.3" from [email protected] npm ERR! node_modules/react-native-orientation-locker npm ERR! react-native-orientation-locker@"^1.5.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See C:\Users\sawan\AppData\Local\npm-cache\eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\sawan\AppData\Local\npm-cache\_logs\2023-02-01T07_19_34_419Z-debug-0.log

Before this I tried running the project, then I started getting another error saying 'So and so module is not present within the project or in node_modules.

Here is the error:

error: Error: Unable to resolve module react-native-linear-gradient from C:\Users\sawan\OneDrive\Desktop\WorkoutApp\workout\src\screens\SignInScreen\SignInScreen.js: react-native-linear-gradient could not be found within the project or in these directories:
  node_modules
   7 | import CustomButton from '../../components/CustomButton';
   8 | import {useNavigation} from '@react-navigation/native';
>  9 | import LinearGradient from 'react-native-linear-gradient';
     |                             ^
  10 |
  11 | const API_URL = Platform.OS === 'android' ? 'http://localhost:3000' : 'http://192.168.2.143:3000';
  12 |

I've tried using --force but after running it again it shows the same error. Do I have to reinstall all my packages again or do I have to change the react version?

CodePudding user response:

Have you tried to stop the application and do the below process:

  • remove node_modules and package-lock.json
  • run npm i --legacy-peer-deps
  • rerun application
  • Related